Instantiate players in Photon. Photon Instantiate error: Index was outside the bounds of the array.
Options
Hi! I´m a new using photon and unity, and I have a problem at the moment to instantiate the players in scene. I'm trying to get two players in different positions when loading the scene. But I get this error: IndexOutOfRangeException: Index was outside the bounds of the array.
what can be the problem? I understand the error which can come from the time of calling the array, but as I said before
I´m a new user in unity. I hope you can help me
Thanks
This is the code
what can be the problem? I understand the error which can come from the time of calling the array, but as I said before
I´m a new user in unity. I hope you can help me
Thanks
This is the code
public class Septup : MonoBehaviour { public static Septup SP; public Transform[] posiciones; public void OnEnable() { if (Septup.SP == null) { Septup.SP = this; } } }
public class PlayerM : MonoBehaviour { public PhotonView PL; public int aparecer; void Start() { aparecer = Septup.SP.posiciones.Length; PL = GetComponent<PhotonView>(); if (PL.IsMine) { jugador = PhotonNetwork.Instantiate("P1", Septup.SP.posiciones[aparecer].position, Septup.SP.posiciones[aparecer].rotation, 0); } } }
0