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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How can I recieve a variable from my level blueprint to add to hud?

I am attempting to receive integers from my level blueprint to bind to text objects within my widget blueprint for hud. Below I have attached pictures of my scoring system created in my level blueprint and of my text that I am currently trying to bind. Any help would be appreciated. Thanks.

alt text

alt text

Product Version: UE 4.10
Tags:
hud1.png (168.6 kB)
hud2.png (38.7 kB)
more ▼

asked Mar 09 '16 at 04:32 PM in Blueprint Scripting

avatar image

Anaklosmos
170 35 29 54

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

2 answers: sort voted first

The way I would do it is make two score variables in the hud blueprint. Bind the text on the hud to the variables. Then all you would have to do is create a reference to the hud in the level blueprint and change the text to whatever the new score is. When you create the HUD in-game set it to a variable that you can then call from that blueprint to edit the variables. For example, if you create your hud in the level blueprint you can create a variable of the hud widget type (whatever you named it) and set the created hud to that. This is what you can call to edit the variables in the hud class. So basically on your On overlap you would get the HUD and set the variables accordingly.

Here is an example level blueprint creating the hud widget alt text

Here is an example Hud class assigning the variables to change the text. Note that this is only one, the other one is the same, just uses the other variable. When you place your text on the canvas under the text hit bind and it will bring up these functions for each text element. alt text

This setup ups the first score by 1 every time you overlap the trigger volume, you can change the actual function however you'd like though.

NOTE: If you're creating the HUD in another blueprint that's not the level blueprint you'll have to first get that blueprint to use the created hud. For example, if you created the hud in the player character class (FirstPersonCharacter, THirdPersonCharacter etc) you would need to get player character and then grab your hud object to edit the text.

more ▼

answered Mar 10 '16 at 09:10 AM

avatar image

Alex8546
178 10 8 21

avatar image Anaklosmos Mar 10 '16 at 04:08 PM

This worked perfectly! Thank you so much!

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

You can use an Interface in your widget and call the interface function from your level blueprint.

Add the interface in you widget, there you can take the event and can add set the float. In the Level Blueprint you just need a referance to the widget, easiest way would be to add it in the level blueprint to the viewport and promote it to a variable. Then take it and there you should see the interface funtion, that you can call.

more ▼

answered Mar 10 '16 at 01:57 AM

avatar image

Sudikinoko
94 5 2 9

avatar image Anaklosmos Mar 10 '16 at 03:55 AM

Could you possibly send screenshots of the 3 screens? (interface, widget, and level blueprint). I had added the interface to the widget, but I must have done something terribly wrong, as it crashed my game every time I tried to launch it. Below I have attached pictures of my interface and my widget. I have since deleted all of this to fix the crashing, but I guess I'm just not understanding exactly what I need to do.

alt text

alt text

d.png (125.6 kB)
f.png (145.4 kB)
(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