Download

How to make an on/off input?

Hey everyone :wave:

Does someone know how to make an input a switch instead of a button ? I tried googling for it but I’m getting no real results. I’d like to use this stuff for switching on lights on/off.

You need somewhere to keep the on/off state as a boolean variable in some actor (either the light, or the controller.)

When you get the “input event pressed” notification, set that boolean to the NOT of itself, and then set the light state to whatever the value of the boolean now is.

I’ll try this out thank you!