Photon Player instantiate position

I am working on a game where there are 5 players joining a photon room, I’m instantiating the player position like this:

PhotonNetwork.Instantiate(Path.Combine(“PhotonPrefabs”, “Myplayer”), spawnPoints[spawnPicker].position, Quaternion.identity,0);

In the spawn points there are 5 different points being chosen at random, however doing that can have 2 players at the same position. Is there a way to not let a player instantiate if there is already an object there(another player) and check for a different spot. I think that raycast or physics.checksphere can work but I am not sure how to implement it here or if there is a better way to do this?


Add a collider on each of the spawn points. A script on each:
public class Spawn point()
public bool Available=true;

public void OnCollissionEnter()

public void OnCollissionExit()

Then in your spawnPicker code, create an array of spawnpoints that are Available==true, choose your random point from that array. :slight_smile:

This should work:

List<SpawnPoint> tempSP;

foreach (SpawnPoint sp in SpawnPoints)
  if (sp.Available) tempSP.Add(sp);

Then tempSP only contains available SpawnPoints that you can choose a random from.