I want to make a switch script, where when the player presses the switch the lights will turn on and off.But the complicated part is when you press the switch not just one , but more than one lights will turn off.
I tried to make a variable of type GameObject like :
var lights : GameObject;
and then on the Update function i wrote
lights.light.enabled = false (or true);
But that wouldn’t work of course.I thought of making a loop with an i for just 10 lights , for testing purposes so i did something like
for(i=0;i<11 lights*.light.enabled = false (or true) ;*
But it said Array out of Index…
How can I enable and disable all the GameObjects from my array?