x

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"

Pass on value between level blueprint and widget

Hi all,

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.

Product Version: UE 4.16
Tags:
more ▼

asked Jul 25 '17 at 04:55 PM in Using UE4

avatar image

Surfstudio
1 2 3

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

1 answer: sort voted first

Hi Surfstudio,

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.

more ▼

answered Jul 25 '17 at 05:52 PM

avatar image

rmcmurra
116 2 6 8

avatar image Surfstudio Jul 26 '17 at 09:14 AM

Hi,

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.

alt text

alt text

screen1.png (126.3 kB)
screen2.png (211.8 kB)
avatar image rmcmurra Jul 26 '17 at 08:23 PM

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.

avatar image Surfstudio Aug 02 '17 at 03:28 PM

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.

(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