GameObject[] Swordmen = new GameObject[10];
void Start () {
Swordmen = GameObject.FindGameObjectsWithTag ("Swordman");
}
It won't add the game objects to the array and if I try this:
GameObject swordman;
swordman = GameObject.Find("Swordman2");
Swordmen [1] = swordman;
It will just say: IndexOutOfRangeException: Array index is out of range.
Please help, it's probably really obvious but I just don't see it.
(And I'm making a enemy array where I can get one and activate it when I need it, I tried to instantiate them into the array but it didn't work either, after it was instantiated if I tried to refer to it I got an error)
↧