'onJoinedRoom()': no suitable method found to override
I checked many times and I can’t find where my mistake is, someone please help, I don’t understand what is happening
using Photon.Pun;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LobbyManager : MonoBehaviourPunCallbacks
{
public Text LogText;
private void Start()
{
PhotonNetwork.NickName = "Player " + Random.Range(1000, 9999);
Log("Player's name is set to " + PhotonNetwork.NickName);
PhotonNetwork.AutomaticallySyncScene = true;
PhotonNetwork.GameVersion = "1";
PhotonNetwork.ConnectUsingSettings();
}
public override void OnConnectedToMaster()
{
Log("Connected to Master");
}
public void CreateRoom()
{
PhotonNetwork.CreateRoom(null, new Photon.Realtime.RoomOptions { MaxPlayers = 2 });
}
public void JoinRoom()
{
PhotonNetwork.JoinRandomRoom();
}
public override void onJoinedRoom()
{
Log("Joined the room");
PhotonNetwork.LoadLevel("Game");
}
private void Log(string message)
{
Debug.Log(message);
LogText.text += "\n";
LogText.text += message;
}
}
Error: Assets\LobbyManager.cs(40,26): error CS0115: 'LobbyManager.onJoinedRoom()': no suitable method found to override
I just can't understand where my mistake or what?? Help plssss guys
Solution 1:[1]
they have changed this in new updates, even if this is an old question, I would like to add the answer I found, as I just came across this question now !
public class NetworkManager: MonoBehaviourPunCallbacks
{
// Start is called before the first frame update
void Start()
{
ConnectToServer();
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Amalnath Sathyan |
