toggle light via hud button

Hello. i have a question. i created a light in my scene and a hud with a button on it. all i want is to toggle the light visibility by pressing the hud button. any help apreciated :slight_smile:

You need a reference of the light in the hud.
Then you can call a function to switch on/off the light.
How to pass the reference really depends of context…

An easy lazy way i found working most of the time:
Create a variable “light” (Actor object reference") in the hud.
Create the widget in the light, on overlap player, on beginplay… or any other trigger depending of your project.
Pass the reference of the light object into the variable you created in the hud.
Create a Switch function in the light.
Call the function on button clicked using the light reference you got.

Thank you for your reply :slight_smile: