I am trying to make an RTS game using Photon Networking For Unity. What I am trying to do is depending on the players in the specific room (2 in this example) all the players spawn at a different location. What I am having trouble is making a system that spawns the players at different locations and not at the same place when the game starts and PhotonNetwork.Instantiate
is called. How can I use SpawnPositions With A list to check if a player is already spawned at the given location if so then it spawns at the next one I hope I covered everything if you need to know anything else just ask.
private GameObject playerPrefab; // Players Prefab
[SerializeField]
public Transform[] SpawnPositions; // 2 Spawn Positions in The unity hierarchy
public List<Vector3> spawnPoints = new List<Vector3>(); // List of spawnpoints to add to
void Start()
{
PhotonNetwork.Instantiate(playerPrefab.name, [what to do here], Quaternion.Euler(0, 0, 0));
}