The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

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).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

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

tomatoway
2022-10-29 21:29:01

Same problem.

Tobias
2022-11-02 09:56:03

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