Instantiating a clone of a persisting player on room change

Hi,

I have scenes loaded by addressables, also player prefabs by addressables. So,I can not use PhotonNetwork.Instantiate for player spawning. Instead I use the custom instantiation example code for instantiation. Then, players are instantiated on, let's say, scene 1. Great until here. Now, in my game, when changing scenes, I load scene 2, move player from scene 1 to scene 2, and leave current room, spend some time in scene 2 with no controls and no network syncronization, then load scene 1 again (and generate environment procedurally), and move player from scene 2 to scene 1, and unload scene 2. I need the position and rotation of the player be stable during this process, for the sake of game logic.

This system works when all players are instantiated on the same scene or if a player creates the room and be the only player in the scene. If another player enters the room as the second player, then the first player owns is prefab instantiated on event call back. I guarantied the view id's are unique through out the system, and confirmed that prefab (on event call back) initiates with view id 0 and immediately changed to original player's view id. Nut, clone of second player is owned and controlled by first player. The first player leaves its original prefab most of the time.

If I can set the runtime bool "Controlled locally" on runtime, probably, that will solve the problem.

How can I solve this problem?
Sign In or Register to comment.