- Home /
This question was
closed Feb 13, 2015 at 01:14 PM by
meat5000 for the following reason:
The question is answered, right answer was accepted
Question by
Nanako · Dec 04, 2014 at 12:10 AM ·
listarray-out-of-range-exceptnullreference
Adding an array to a list. throws a nullreference exception
players.AddRange(GameObject.FindGameObjectsWithTag(Tags.player));
This line of code apparently doesn't work, and throws a nullreference. I'm attempting to find all objects tagged player, and put them into a generic list of gameobjects called players.
What's wrong with it?
Comment
Best Answer
Answer by Habitablaba · Dec 04, 2014 at 12:19 AM
does the players object exist? Did you call new?