Now you should be able to toggle the lights by pressing the RMB.
I’m not exactly sure what it is you’re trying to achieve though, but reading through your code I can notice a few contradictions. Such as “Lights” is being associated with a tag and not an actual object so it does this in sequence not altogether. Also there are a few lines of code that don’t really make any sense such as line 2.
Konkor4: Thanks for your post! When I started scripting unity I was having trouble accessing scripts on other GameObjects. So I got in the habit of trying to control everything from a central script. I’ve actually been wondering what the best way to organize all of this was. I’m creating interactive architectural walkthroughs, in this case, you can turn lights on and off . My main ‘UnerInterface’ is getting out of hand, and if one piece of code doesn’t work, the entire thing doesn’t work. I was also thinking it would be hard to keep tract of scripts on each GameObject. What is the best way to organize and keep tract of scripts?
Your question about line 2, 1st code block or 2nd? 1st ‘LightsOn’ is a bool. 2nd defining an array. I usually stick with the first thing I get to work, it’s often not the best approach.
In your code, why are you using Var instead of Bool? And thanks again!