Control one light with 2 switches

I have seen many answers on how to control one or more lights with a switch blueprint but how can I control one light with 2 switches? Imagine a hall light and you turn it on from downstairs then go to the top and turn it off with another switch. Any ideas?

This would be very easy to accomplish. If you want to make each change to each switch change the light, then you have only to make a toggle function that you call. So you call the same toggle function from both lights. Just link the same light to both switch.

If you want to have distinct states where turning the switch to on will only lead to the light being turned on, and turning the switch to off will only lead to the light turning off, then you have to make two functions called turnOn and turnOff and then simply call each from both switches’ On and Off states.


I would suggest building a interface, or use casting to cast to the light from the switches to a flipflop, each time a button is pressed the state of the flipflop will change. Then in that flipflop function in the light class, make your logic for turning on and of on the two different excecution lines.

Thanks very much for your responses. I have tried what you have suggested but it just wasn’t working. I could get lights to turn on and off with the first switch but the second switch was being ignored even though it was connected to the same light. I seem to have figured it out so here are the screen shots of what worked. First, the LightBP has a custom event to toggle visibility.

Then in the SwitchBP

Each switch can have a chosen light (or lights) to affect and this setup seems to work with multiple switches attached to one light.

And finally you can set each light to be on or off at the start of play

First and foremost, change this ANSWER into a COMMENT to my answer please. You do that by clicking the little triangle under your answer.

Then, why are you using an array? Can you print the array size and make sure it is not 0? How to you add the references to the lights?

I appreciate you responding to my question but as my post is a more complete answer I will leave it as an answer.

I am using an array for both a learning experience as well as giving the option to allow more lights controlled by each switch. I have seen many posts describing what I am doing and arrays keep coming up. So I am using it. I’m not sure I understand what you mean by print the array size. As I understand it, the array gives me access, through blueprint communication, to all the lights found in the array, which in this case are the pointlights found in my “bulb” blueprints. So for each switch I can choose, or reference, any or all of the lights present in my level. Maybe there’s a better way but right now this is working.

I discovered the source of the problem wasn’t the setup at all. I already had what you see above. The problem was a collision box was intersecting the switch! Fixing that meant the switch now is accessible and works as intended.