Spawning players at position
Options
Hello,
Im tryin to spawn Player at their specific spawn location.
Im tryin to spawn players like this inside Start method
But the second one is spawning on spot which makes literally no sense.
Anyone could help ?
Im tryin to spawn Player at their specific spawn location.
[Tooltip("The prefab to use for representing the player")] public GameObject playerPrefab; public List<GameObject> spawnPositions = new List<GameObject>();The spawnpositions list is actually just two gameobjects which are set on the positions i want to spawn
Im tryin to spawn players like this inside Start method
if (playerPrefab == null) { Debug.LogError("<Color=Red><a>Missing</a></Color> playerPrefab Reference. Please set it up in GameObject 'Game Manager'", this); } else { Debug.LogFormat("We are Instantiating LocalPlayer"); // we're in a room. spawn a character for the local player. it gets synced by using PhotonNetwork.Instantiate GameObject x = PhotonNetwork.Instantiate( playerPrefab.name, transform.position, transform.rotation); if (x.GetComponent<PhotonView>().OwnerActorNr == 1) { x.transform.position = spawnPositions[0].transform.position; } if (x.GetComponent<PhotonView>().OwnerActorNr == 2) { x.transform.position = spawnPositions[1].transform.position; } }But the problem is , the Player1 which is MasterClient , is spawning right. On the exact spot i need him to.
But the second one is spawning on spot which makes literally no sense.
Anyone could help ?
0