I’m trying to place a bunch of similar gameobjects into an array that have the same true value as to be ‘active’.
Here is my code, which I understand why it is wrong, I’m trying to get a bool and put it into a gameobject array, not going to work, can’t figure out how to do this without doing a Gameobject.FindObjects with Tag, and make the other script put the box in the active tag whenever I do something, however that just seems cumbersome, any better ways?
public GameObject[] activeBoxArray;
public GameObject[] boxArray; // This is set to 7, and is the amount of boxes I normally have, when I click on them, the boxActive bool is set to true, and then I want to put that in the new array when the game is started by the player.
if (Input.GetKey(KeyCode.Return))
{
for (int i = 0; i < boxArray.Length; i++)
{
activeBoxArray *= GameObject.Find("Box" + i.ToString()).GetComponent<BoxController>().boxActive == true;*
-
}*
}