I have triggers in my game that set gameObjects in an array to active from inactive using SetActive(true/false).
Some of these triggers have different amounts of gameObjects to make active than others.
Currently in my Start function I have these lines of code to set each gameObject attached to the trigger to SetActive(false):
For triggers that have less than 3 gameObjects in their array it returns an exception because there isn’t always 3 gameObjects that need to be set to inactive.
What kind of code could I write that runs through each gameObject in an array, sets them all to inactive and then stops running once they have all been set?
I’ll be here to reply to any questions you have if I didn’t explain something well enough
Fun fact, that is called a “for loop” and if you type “for” and hit tab twice, your script editor will autocomplete it for you. That shortcut will be a dear friend to you in many situations.