I have this to spawn the player at one of three spawn locations (there will be 3 players), but how do I stop players spawning in the same spot?
public void OnJoinedRoom()
{
if (PhotonNetwork.playerList.Length == 1)
{
Debug.Log("2 Players In Room Starting Level");
number = UnityEngine.Random.Range(1, 3);
if (number == 1)
{
spawnpoint = GameObject.FindWithTag("spawnpoint1");
}
if (number == 2)
{
spawnpoint = GameObject.FindWithTag("spawnpoint2");
}
if (number == 3)
{
spawnpoint = GameObject.FindWithTag("spawnpoint2");
}
}
GameObject myPlayer = PhotonNetwork.Instantiate(playerprefabname, spawnpoint.transform.position, spawnpoint.transform.rotation, 0);