Pun 2 - override doesn't work
Hello,
I'm just starting my journey with Photon Pun 2 in Unity. I have set up everything like in this tutorial:
For some reason when I try to create override function it gives me errors, that VSC cannot find funtion to override.
Libs I'm using:
using Photon.Pun;
using Photon.Realtime;
Part of code where I can't override functions:
public override void OnConnectedToMaster()
{
Debug.Log("You have joined Master");
PhotonNetwork.JoinLobby();
}
public override void OnJoinedLobby()
{
Debug.Log("You have joined");
}
Anyone know what might be an issue? I have looked over google, but no solution found... :(
Thanks in advance for help!
Best Answer
-
Ok I found solution.
"OnConnectedToMaster is an override for MonoBehaviourPunCallbacks.OnConnectedToMaster(), whilst there is no similar Function in MonoBehaviour. That's what the Console Error Log shows you - so edit your class Definition to: public class PhotonLauncherScript : MonoBehaviourPunCallbacks"
1
Answers
-
Ok I found solution.
"OnConnectedToMaster is an override for MonoBehaviourPunCallbacks.OnConnectedToMaster(), whilst there is no similar Function in MonoBehaviour. That's what the Console Error Log shows you - so edit your class Definition to: public class PhotonLauncherScript : MonoBehaviourPunCallbacks"
1