Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

FindGameobjectsWithTag -> Array

$
0
0
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)

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>