- Home /
Photonnetwork check when somebody connects/disconnects
Hello there.
I am working on a multiplayer FPS with PhotonNetwork and I want to have some info updated everytime somebody connects or disconnects.
Are there any functions about that?? I searched at Photon's documentation but found nothing :/
Answer by praveee · Sep 05, 2014 at 11:21 AM
What photon service you are using? in Photon PUN (photon unity networking) you can check it like below
public void OnPhotonPlayerConnected(PhotonPlayer player)
{
Debug.Log ("Player Connected "+ player.name);
}
public void OnPhotonPlayerDisconnected(PhotonPlayer player)
{
Debug.Log ("Player Disconnected "+ player.name);
}
for more info check PhotonNetwork Class Reference
What could be the possible reason for "Photon Disconnect" ? Let me know if there is any information on it. I am connected to internet and my internet is also working fine. Thanks in advance.
Hello! Im trying to use OnPhotonPlayerDisconnected but just doesnt detect it as a valid type or namespace, I dont know why. I'm using Photon.Pun and MonoBehaviourPunCallbacks
Answer by NotJoosan · Nov 25, 2021 at 05:30 PM
Well, if anyone has this problem I did find the solution.
public override void OnDisconnected(DisconnectCause cause)
{
base.OnDisconnected(cause);
Debug.LogWarning($"Player disconnected: {cause}");
}
Your answer
Follow this Question
Related Questions
Unity Character Move Over PhotonNetworking 0 Answers
Synchronize array with simultaneous access via Photon Network RPC 1 Answer
Photon Syncing Animations 2 Answers
Photon Networking Spawn player 2 0 Answers
How does photon interact with scenes? 0 Answers