OnPlayerEnteredRoom( Player newplayer ) not working
Options
using Photon.Pun; using Photon.Realtime; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class RoomCreation : MonoBehaviourPunCallbacks { public void createRoom(string roomName) { RoomOptions roomOps = new RoomOptions(){IsVisible = true,IsOpen = true, MaxPlayers = (byte) 4,PublishUserId = true}; PhotonNetwork.JoinOrCreateRoom(roomName,roomOps,TypedLobby.Default); } public override void OnPlayerEnteredRoom(Player newPlayer) { Debug.Log("player join"); Debug.Log(newPlayer.ToStringFull()); } public void leave() { PhotonNetwork.LeaveRoom(); } public override void OnPlayerLeftRoom(Player otherPlayer) { Debug.Log("player left"); }
this is my code i dont know why both OnPlayerEnteredRoom & OnPlayerLeftRoom is not working for me
other function is working thank you for your help
1
Comments
-
Hi @Shimagurat,
Thank you for choosing Photon!
OnPlayerEnteredRoom & OnPlayerEnteredRoom are for remote players not for the local player.
The local player has OnJoinedRoom & OnLeftRoom callbacks.
In case you still don't get those even for the remote players then make sure to check the Matchmaking Checklist are probably players are joined to different rooms either because different AppVersion or different Region.
Or maybe you did not even join any room as not connected yet.-1 -
Hi Thank you for the answer already solved the problem that they are on different Region so that is why it is now working thank you0
-
Hi,i have tha same problem,how did you solve that?,all the connection to the servers works but onPlayerEnteredRoom and OnPlayerLeftRoom don't work
1 -
I am facing the same issue with "OnPlayerEnteredRoom" not wotking. Rest all the functions work correctly.
I have an old project which I made in May 2022, there "OnPlayerEnteredRoom" worked fine. I guess they might have updated the API or something.
0 -
My problem was that in the method "OnEnable" i hadn't called base.OnEnable
0 -
Depending on how old your project was, maybe you didn't register for getting callbacks in the very old versions. You need to do that now!
0