Hello ,
I’m building a simple multiplayer game having :
LoadingScene => to connect to photon server.
LobbyScene => GUI where I create the rooms ( room size and roomName fields) and button create and join room.
MatchMakingScene => where I spawn players (instantiated using photon) and once the room is full I photonNetwork.Load(the next level) AKA the actual game scene say GameScene.
The problem is once in the GameScene , the players are destroyed at the beginning. !!
PUN-instantiated ‘Test(Clone)’ got destroyed by engine. This is OK when loading levels. Otherwise use:
I tried using DontDestroyOnLoad , the player survives switching scene from matchmakingScene to gameScene
but I have no control on it , null reference everywhere)
I have Two questions please :
- Is there a clean way to keep player between scenes without issues?
- What is the best practice : is it to keep player between scenes or instantiate players in each scene , especially that in a future scene the spawn position will be completely different.?
I hope the scenario is clear and Im ready if more details are needed .
Thanks in advance.