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.
Thanks for the screenshot. I don’t have any experience with this plugin, but I downloaded it and gave it a shot. I think the node you’re looking for is called Get String Field. You should be able to hook it directly to your JSON Data Out variable node, and plug it directly to your Print String/Set nodes.
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?
thanks for the help. I tried to run everything from within the actor but it didn’t work. Then, I tried again from the level blueprint (since this is my preferred location to have this REST call fetch the data). So, I am able to use a set-command inside the level blueprint that would reference to the variable inside the UMG widget that witholds the text field (lounge-infopanel-temp) that I want to fill. But if I drag the value (see screenshot) to the Set, it mentions "String is not compatible with Text Reference. I assume I’m very close to what I need but not there yet.
Hi rmcmurra, thanks for your help. I’ll try to test it this week and let you know if it works. I just want to store a value (regardless if it’s from VAREST or anything else) coming from my level blueprint inside a UMG text field.