How to Properly leave game?
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
How to Properly leave game?
Johan_Liebert96
2022-10-28 03:31:19
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?
Comments
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)...
Back to top