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"

Widget Blueprint interaction with Level Blueprint

Is there a way to make a button pressed in the widget blueprint to act as an event in the level blueprint?

Product Version: Not Selected
more ▼

asked May 01 '15 at 01:21 AM in Using UE4

avatar image

16 2 5 5

avatar image Stayfirst May 01 '15 at 09:37 PM

Anything ?

avatar image Stayfirst May 04 '15 at 02:55 PM

Sorry to post again I'm just wondering if I'm asking the question wrong or is it a hard one? :)

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

1 answer: sort voted first

The thing is that you need an access from the Actor to the Level Blueprint, but the Level Blueprint, as far as I know, isn't accessible from wherever.

There is a workaround based on Event Dispatchers. Go to Your widget and add Event Dispatcher and call it, for example, MyEvent. Then simply call it when pressed the button:

alt text

In the Level Blueprint right after you create widget (RollerHUD here) bind the other event that will do what you want:

alt text

But I'm not sure if this is what You want.

I suggest to use GameMode for any global methods and events. You can have an access to the GameMode by simply using Get Game Mode and casting it to Your GameMode.

ev2.png (25.6 kB)
ev1.png (85.9 kB)
more ▼

answered May 04 '15 at 05:44 PM

avatar image

755 24 48 145

avatar image Stayfirst May 05 '15 at 01:46 AM

Hey there,

Thanks for the quick reply and sorry for being a complete dum dum.

Can you try helping me with one more time?

alt text

alt text

Thank you in advance.

avatar image zompi2 May 05 '15 at 09:12 AM

In Your widget #2 add new Event Dispatcher (it is in My Blueprint tab) and call it OnButtonPressed. Then:

alt text

alt text

The OnButtonPressed_Event can be created by using "Add Custom Event" in blueprint.

In other words - You must think kinda backward. You have to make an event in the widget and bind an event from the level blueprint to the event in the widget. It works like delegates.

But I'm worry about that Remove From Parent and Construct nodes. Are you destroying Widget itself and create it again? You might lost the bindings then.

avatar image Stayfirst May 05 '15 at 03:38 PM


Thanks for the reply and to answer your question, yes I destroy old widget when getting a new one. I could leave it hanging but how do I destroy all of the widgets at the same time later?

Also here is what happened with previously suggested solution: alt text

Thank you in advance.

3.png (140.6 kB)
avatar image zompi2 May 05 '15 at 03:44 PM

You must add an Event Dispatcher "MyEvent" in the "Terminal sendreceivedeliver" widget, not Level Blueprint (if I undestand it correctly the widget #2 is the Terminal, right?)

I'm not sure what do you want to achieve when you press the button. But maybe you should Call the "MyEvent" before destroying the widget.

avatar image Stayfirst May 05 '15 at 04:25 PM

I do have the event dispather: alt text

Yes widget #2 is the terminal.

I mean the reason I have multiple widgets is because I wasn't able to find a way to create a multi level menu in a single one so maybe that's the correct solution here?

4.png (88.5 kB)
avatar image zompi2 May 05 '15 at 04:34 PM

It's hard to explain something when I don't know how it should work... So I made a simple project with Widget and Event Binding to the Level Blueprint ;) (compatible with 4.7.5)


I'm not into widgets and UMG yet, but maybe you can create some kind of parent widget and children in it?

avatar image Stayfirst May 05 '15 at 11:08 PM

Hey there,

Thanks for spending so much time with me. This solution does work for 2 stage menus but seems to not work with more. Here is your example back with added structure.link text

Thank you in advance.

eventexample2.zip (506.0 kB)
avatar image zompi2 May 06 '15 at 08:53 AM

You forgot to connect "Add to Viewport" with "Bind Event to secondwidget_button" in Level Blueprint ;)

alt text

I've just got idea that you can do the light switching in other way. You can create a variable in the Game Mode that will hold an instance of the light switch. In Level Blueprint you can Set it into the instance of the light switch in the Game Mode. After that you should have access to the light switch from the Game Mode, which should be accessible from the Widget (Get Game Mode).

lol.png (47.2 kB)
avatar image Stayfirst May 07 '15 at 02:23 PM

Well lol, ok! Thanks for helping me figure out the issue.

Also what happened was because I called another widget from the widget blueprint it for some reason messes up the dispatcher function in the final widget.

My solution was to make all widget buttons call only a dispatcher and use that to assemble my menus in the level blueprint. In a sense it feels like we're missing the point of widget blueprints here but it's the only way to interact with the level I was able to find.

Thank you very much and have a great day!

(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