PhotonNetwork.instantiate issue


I am using photon unity networking. To spawn players on local and remote devices(iOS and android), I am using this function PhotonNetwork.Instantiate. When new player gets connected , It automatically spawns the player at remote device. I have created custom matchmaking in which it make's sure every client receive all the required data for starting the game and also checks if total responses received (map received message sent back to master/host) available are equal to total number of remote players spawned. I tested it and it works perfectly fine during testing. Now, app is live, Most of the times everything works fine but I noticed sometimes room gets freezes and game doesn't start. When I debugged the issue, I found out that sometimes for example if 3 other clients are connected then only one network player spawned. I didn't destroyed any player object. Does anyone having same issue? How can I make sure all the players are spawned ? Is this because of the latency or clients connection issue ?


  • Sorry for the late reply.
    Errors like this are really hard to debug, especially without being able to look at all the details.

    In theory, yes, it could be related to lag. If your game logic depends on some order of events or how you expect data to arrive, then this lag on one client can affect the others.
    You could check which events trigger which action and how they relate to each other.

    It could also be related to a bug some others reported. In some cases, players get stuck in a room, even when their connection was closed a while ago.
    In that case, the stuck player will become the Master Client technically but won't do anything. This can easily break your logic, too.

    We are working on a fix and hope to deploy a new server version today. That will have a workaround for stuck players.
    Otherwise we're not aware of errors that affect your case.

    Can you let us know if you find out more?
  • Sorry for the late reply.

    Yeah that can one of the probable cause which can result in the issue currently I am facing. Let me know ASAP when this issue has been fixed so that I can verify if that was the reason.

    Thank you :)
  • The workaround for "stuck players" is deployed since last Thursday and so far, we got no reports that this happened again.
    Please let us know if you find something suspicious like a Master Client not doing anything anymore for a long time (give it at least half a minute or better several minutes, to make very sure it's not a very slow timeout disconnect for that user).
  • Hi, To get more info when my game room gets stuck. I created matchmaking in which each step log is saved on each client and master side. The purpose was to get master/client exact last state and function execution.Now my game is live. And I didnt notice any issues but today, There is player(MasterClient) who is stuck during matchmaking. I tried to get the log from the client but their is no response. And its now round about 30 mins and whenever I try to join random room. It gets connected to the same client. After that I thought may be their is an issue with my logging. I tested it locally and it works. I think the bug you fixed still exists :?
  • If you can join such a room with a stuck master, then you can also fetch the IP of the server and the room name.
    Send us the Game Server IP, room name, time and date and please simply include the appid, PhotonNetworking.punVersion and GameVersion you use.
    Mail to: [email protected]
    Please note: On Monday we have a bank holiday in Germany, so responses will take a bit longer this weekend.