Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Communication between Blueprint & Widget

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 Blueprints look like this:

alt text

alt text

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.

In regards thanks for your help.

Product Version: UE 4.18
widget.png (77.5 kB)
blueprint.png (136.0 kB)
more ▼

asked Jan 14 '18 at 12:40 PM in Blueprint Scripting

avatar image

10 2 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey there, that begin play is for the light or for the player?

more ▼

answered Jan 14 '18 at 01:02 PM

avatar image

6k 161 129 304

avatar image STRGnine Jan 14 '18 at 01:23 PM

It is for the Light. I also tried the same setting with the Level Blueprint before, without success.

avatar image xlar8or Jan 14 '18 at 01:30 PM

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.

avatar image STRGnine Jan 14 '18 at 02:21 PM

alt text

Worked like a Charm, Thank you very much!

widget2.png (234.1 kB)
avatar image xlar8or Jan 14 '18 at 02:25 PM

Good to know, please mark the answer as correct :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question