Toggle Lights with UMG

Hi guys,
I’ve been trying to turn on/off some lights with a UMG button. I’ve read a bunch of stuff, but since I’m new to Unreal I’m not getting any results.
The workflow I’m trying is:

1- Create a blueprint called Wall Sconce with a Spot Light component, and a Event Graph with a simple custom event linked to a Toggle Visibility;

2- Create a UMG blueprint that, On Clicked, will select all instances of the Wall Sconce and run the simple event created at Wall Sconce.

What am I missing?
Thanks a lot, cheers!

It seems like it should work, maybe visibility isn’t the problem. Maybe start by making the lights to switch on/off automatically every 1 second to see if it works.

You should set light intensity rather than visibility. Toggling visibility will dictate whether the light objects are visible in the world, not whether they will be switched on/off. Set light intensity to 0 for switching off, and then to <insert preferred value> when you need them switched on.

Hi guys, I got it solved, thank you for your input!
Since some noobies like me may be looking for a solution as well, I’ll explain what was the issue.
To make a widget interact with a light we need a total of 3 blueprints:

  • One actor blueprint with the light itself, where the code will execute exactly what you desire with it, in my case an animation with the intensity:

  • One widget blueprint with it’s layout (buttons and such), where the code will call the the event from the light blueprint:

  • One actor blueprint with the widget blueprint loaded, where the code is merely for enabling the user to properly hover over the buttons:

The reason I was doing wrong is because I was ignoring the code from the widget blueprint.
If anyone has a better way of doing it, please do tell us!
Hope this helps.

Cheers!