I have a car prefab that I’m making, and I was wondering how I would go around setting lights to have three settings. I have set up 3 sets of lights; parking lights (on low), low beam, and high beam. I also have a light for parking and low beam (both spotlights) which is a near-white ambient light, and also a light blue one for high beam. What I want to do is set it so on the first setting (pressing a button, for example, f, the first time), the parking light and it’s ambient light go on, when the button is pressed again, it activates the low beam and leaves on the parking lights, and when pressed again, activates the high beam and it’s ambient light.
Thanks for any help.
You could have several child objects, each with its own Light component set up appropriately (eg, the low beam lights would be pointing downwards, the parking lights would be very low brightness, etc) and then access them from the script using transform.Find.
Just create array of boolean for each light, where index is “state of light switch” and on your event (eg. key press) just ask about position of switch (add 1 to it or reset it if its too big) and set Enabled properthies of your lights to the arrays.
<—Nonsense, I forgot you can use switch instead. So do It
As a “parameter” use variable you are using to switch. Then add code similar to this one (tweaking needed):
switchstate+=1;
if(switchstate>4)
switchstate=0;