First off, I’ve searched multiple questions, but this is such a general error that it’s different for each person.
I’m trying to setup an array of GameObjects. I’ve done this successfully once already with
GameObject[] abs;
void Start () {
abs = GameObject.FindGameObjectsWithTag("all_buttons");
Then I call use it later with:
foreach (GameObject X in abs) {
X.light.enabled = false; }
But I want to put certain game objects in certain places in the array. Here’s what I’m doing:
GameObject[] lightsequence;
void winner() {
lightsequence[0] = GameObject.Find("5Red");
That’s where I get the error of Object reference not set to an instance of an object. 5Red has a tag of all_buttons; I feel like I’m putting that game object in an array when I use FindGameObjectsWithTag, but when I use just Find it’s not finding it.
Thanks in advance