How can i send events from widget to level blueprint

I Have a Slider in the widget Blueprint.
is it possible to send the OnValueChanged Event to the level Blueprint?
I tried it with a object variable like in the doc, without success
https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/BlueprintComms/index.html
I get the event to the level blueprint but it doesnt fire

I also saw this UMG, How to bind a value to a slider? - Editor Scripting - Unreal Engine Forums
But i am no sure how to set up the event dispatcher.

For now i send the value in a global variable via Interface blueprint, but i need a tickevent to get values from the slider.
it would be better to fire only onValueChanged.

1 Like

Hey, I’m new to Unreal Engine, but this is how I understood it works:

  1. Create an UMG blueprint for your widget, I called mine UMG_SliderBlueprint
  2. Drop a slider on it, in the Designer view, I renamed it to MySlider
  3. Switch to the Graph (blueprint) view
  4. Create a new Event Dispatcher, I called mine MySliderChanged
  5. Select your Event Dispatcher and add a Float input in the Details tab, I called mine Value (how original!)
  6. Now add Call MySliderChanged and hook it up

  1. Compile the blueprint and after that open the level blueprint
  2. Create the widget and add it to the viewport as usual.
  3. Next add the My Slider Changed binding and event (you get them both if you choose Assign)
  4. Hook up the blueprint, and e.g. display the slider value every time it is updated

I assume you already set the input mode, and show the mouse cursor, so you can actually change the slider. This should be a fully working example of what I understood you need. As said, I am new to Unreal Engine, so if there is a better way I would love to hear about it.

2 Likes

Thank you very much!

Dude, thank you so much! You probably just saved me a day of work.

i just added you to my hero list. thank you!

Just wanted to say thank you, I’ve been digging through tutorials, examples, etc. all day just trying to pass a variable from one blueprint to another using casts, events, etc but pretty much every example is either “Ok I’ve already created this and that and here’s where you tie them in” but they don’t bother to show how certain things were created or “Here’s 3 sliders all doing this stuff” and they zip all over flipping between blueprints showing tons of connections but never really explaining how things are passed. I just needed a foundation to start, and got that right here. So thank you, got all my stuff working!

This has been helpful, but I was really confused on some of the steps, but I think I learned some things that would be really useful for someone else as new as I am:

At Step #8 you need to “create the widget” and “add to viewport”, you can do that by right clicking in your level blueprint and search for “create blueprint”, then when the node is there under class select the name of the blueprint you made earlier. Then to add to viewport click and drag off the top right empty port on that same node, then when you release type in the search “add to viewport”

Step #10 had be baffled for a while, initially I was creating a new event dispatcher in the level blueprint as well called MySliderChanged then dragging it in and selecting assign to get the two nodes, but this apparently is wrong and those new nodes are not attached to the one in the widget even though the names may be the same. Instead I tried having two windows open (the widgetBP and the levelBP) then I dragged the MySliderChanged event that was under the MyBlueprint tab>Event Dispatchers and dragged it all the way over to the LevelBP and once I let go of the button I selected assign.

Hope this helps somebody!

amcofi thx a lot mate it helped too much

thank you very much, its wonderful !

Wow. So good explanation! I actually was trying for 1 month from time tio time to call event and only after your explanation i finally understood how to do it, thanks!

Hi everyone!
I had a problem with this tutorial. It works fine but just once after i begin play, and that’s it. When i try to click a button on widget - nothing happens. What may cause this?

Hi, I have a question. If I don’t want that the Widget Blueprint to be visible from the beginning of play, will it work if I don’t add it to the viewport?

1 Like

@HKonashevyhc Consider asking a new question rather than bumping a 4 year old thread.


If I don’t want that the Widget Blueprint to be visible from the beginning of play, will it work if I don’t add it to the viewport?

You can add / remove widgets from the viewport at any point, it does not need to be on Begin Play. You must store a reference to the created widget, though. Dereferenced widgets will be destroyed.