(PUN2/Photon) Stop players from spawning in the same spot?

Hi! First ever post here.

So, this isnt an original post but Any way to stop players spawning in the same place? Didnt really help since my players dont move, they are stationary in their spawn.

Below is what i have as the spawning code. What would i need to add to this if i want to make sure no player spawns in the same spawn? Because currently they can/do.

    public void Spawn()
    {
        int randomNumber = Random.Range(0, spawnPoints.Length - 1);
        Vector3 spawnPoint = spawnPoints[randomNumber].GetComponent<Transform>().position;
        Debug.Log("Creating Player");
        PhotonNetwork.Instantiate("Player", spawnPoint, Quaternion.identity, 0);
    }

(i have Spawn(); in Start())
Non coder here, well i can code but pretty new and only basics.

Each connected player has a PhotonNetwork.LocalPlayer.ActorNumber which is unique.
This could be used to place each joining player on a new spot.
Downside: When a player leaves, the spot is empty.

Better:
The PlayerNumbering component will handle leaving and joining players and assign player numbers. Let’s say 1 to 4 in a 4 player room / game.
Place 4 objects in the scene as “spawn point marker” and assign numbers 1 to 4. Pretty much done.

1 Like

PhotonNetwork.LocalPlayer.ActorNumber is used for such this thing . This could be used to place each joining player on a new spot. Otherwise a simple integer counter can do your work on just increase that value at time of instantiating of players.