How to Properly leave game?

So I'm currently trying to make player leave current room when they die, I simply made a function for it, makes the player leave room and team, as well as loading menu scene. Problem is, I get a hella lot of errors when the scene loads, all my variables and panels attatched to my NetworkManager.cs are missing, so theres obviously a problem in how I'm calling this, whats the best way to make player leave room and load menu scene after they die?

Answers

  • Same problem.

  • I would call PhotonNetwork.LeaveRoom(). Then wait for the callback OnLeftRoom() or even for OnConnectedToMasterServer(), which means you are back to the server where matchmaking gets done. Load the next scene "locally" and not via PhotonNetwork.LoadScene (this is only for networked in-room scene loading)...