Good day good people!
I’m currently working on a project, where the user should be able to control the lighting of the scene with an UI Widget.
The user presses L, a small window pops up in the corner and the user can check a box to turn specific lights on and off. I want simply to toggle the visibility of the lights - Blueprints with this checkerbox.
My Problem is, that the Blueprint doesn’t get any messages from the Widget. The LightControl Reference is valid and the Print Strings show that the Event has been called and bound. Only the LightSwitch Event doesn’t print anything.
The problem with that approach is that if you have multiple lights, they all will create that widget. What i believe makes more sense is that when you press L you create and add the widget in the player code. What you need next is a way to give the widget references to the lights you want to change the visibility, if you want to be able to control all of the lights then you can do a get all actors of class (and select the type of the light blueprint) and for each of them you change the visibility. If you only want to interact with a few you can create a light array in the widget and set instance editable and expose on spawn and when you create the widget you can supply a list of the lights that you want to able to interact.