Pass on value between level blueprint and widget
I have code, which calls a REST service using VAREST plugin and gets a value back, in my level blueprint. I then want to show that value inside a text widget (UMG) which will then be displayed inside the level (as a 3D widget).
I can't find a proper way to do this. I know how to pass on values from a widget to the level bp but not the other way around. I then tried to add all my code in the wiget (so I can bind it to the text) but for some reason, I can't make custom events inside the UMG widget. I did find some tutorial that explains how to assign variables to the player blueprint and then retrieve them from an UMG (e.g. health bar for the HUD) but that doesn't seem to be a clean solution for my purpose since I prefer not to use the player blueprint but just the level blueprint.
Anyone who can explain how I could pass on the value of a variable from my level blueprint to my widget?
asked Jul 25 '17 at 04:55 PM in Using UE4
If I am understanding you correctly, here's what I would do: Create an Actor class blueprint, and then add a Widget Component to it and assign it your Widget class. You could then store your custom events in that Actor and it would deal directly with its Widget component. Even if your custom events stay in the level blueprint, you could reference that Actor directly in the level blueprint (if it starts in the level) and set the variable directly. Or, use a Get All Actors of Class node to find it (if it is dynamically spawned) and cast to it.
Follow this question
Once you sign in you will be able to subscribe for any updates here