Home > other >  Why doesn't OnPlayerEnteredRoom() method work?
Why doesn't OnPlayerEnteredRoom() method work?

Time:06-26

i make room in unity with photon pun. When i join the room, OnPlayerEnteredRoom() doesn't get call. Code:

public void OnPlayerEnteredRoom(Player newPlayer) {
    PhotonNetwork.Instantiate(playerPrefab.name, new Vector3(0,0,0), Quaternion.identity);
    Debug.Log("Player has joined!");
}

CodePudding user response:

Did you call the method when enter the room?

CodePudding user response:

First of all, you have to inherit MonoBehaviourPunCallbacks and override method OnPlayerEnteredRoom(). OnPlayerEnteredRoom() works only for remote players. Just read documentation :)

  • Related