Photon.Instantiate causes second-created player to swap places with first

Obviously working with PUN here. I’m creating a game based on the Marco Polo tutorial. I’m running one instance of the game on Computer 1 (my main machine), and I’m running another (build) instance on Computer 2 (the laptop sitting next to my main machine). (I’m running the other instance on a separate machine just to make sure that two instances on the same machine was not causing the problem I’m about to describe.)

I start one instance on Computer 1, go through the lobby, create the room, and join the room. My player prefab spawns at a random spot within a certain zone.

I start the second instance on Computer 2, join that game, and this new prefab should also spawn at a random place within the same zone, but instead, it immediately switches places with the spawned player on Computer. And the player on Computer 1 goes somewhere else (I assume where the Computer 2 prefab would have spawned, if it was working right).

The spawning code is pretty standard:

Vector3 spawnPosition = new Vector3(Random.Range(-10.0F, 10.0F), 0f, Random.Range(-10.0F, 10.0F));
PhotonNetwork.Instantiate(, spawnPosition, Quaternion.identity, 0);

Any thoughts why this might happen? Thanks.

I am also working with PUN and one thing that you have to look out for is your player controlled scripts and camera’s in the scene. I don’t know if you have done this but make sure that your camera of your player prefab is disabled and then enable it with a script when you spawn the player, do the same for player controlled scripts, otherwise players would be able to control each other x_x
Hope this helps :smiley: