Network.Instantiate players at each spawnpoint? Don't use the same spawnpoint?

How would I get it so that I have 5 players spawn in DIFFERENT spawnpoints? I have empty gameobjects as points. I can’t use random because players might collide with each other. Help?

For a prototype we did some time ago (with Unity 2.6) i simply checked the spawnpoints with Physics.OverlapSphere. Just make sure your spawnpoints are not too close. Usually your players are on a seperate layer, so you can pass a layermask to OverlapSphere to only search for players. Just iterate over all spawnpoints, check which ones are “free”, put them in a list and randomly pick one from the list.


// C#
Transform FindSpawnPoint()
    Transform[] spawnpoints = GameObject.FindGameObjectsWithTag("spawnpoint");
    List<Transform> freeSpawnPoints = new List<Transform>();
    foreach(var T in spawnpoints)
        var players = Physics.OverlapSphere(T.position, 2, 1 << PLAYER_LAYER);
        if (players == null || players.Length == 0)
    if (freeSpawnPoints.Count == 0 )
         return null; // no free spawnpoints!!!
        return freeSpawnPoints[Random.Range(0, freeSpawnPoints.Count)];