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"

Can't set valid values on construct inside UserWidget

Hi all,

I try to set a reference to an C++ defined UActorComponent ("GameplaySystemComponent") on construction of my user widget.

Basically the GameplaySystemComponent should send a delegate broadcast when an attribute (e.g. Health) updated his value. The given user widget listens to this delegate to update his healthbar.

My issue:

The only way to get a valid reference is when I find my testing Actor ("NewBlueprint"-class) on "Event Construct" and get his GameplaySystemComponent like in the screenshot below.

Event Construct of my user widget which get a valid reference

Every other (preferred) way doesn't work for me. On "BeginPlay" of my testing Actor i create the widget and set the reference which is marked as "expose on spawn" and right after, I use a "Initialize" function to set the reference manually. Inside this function the reference is valid, but right after it is invalid. Even if I delay the function it doesn't work.

Event BeginPlay of my testing Actor

I also tried with other variable types like Text or float and every time it is the same. I'm also confused by the callstack. As I know "Event Construct" is something like "BeginPlay" for Widgets, but "Initialize" is called before "Event Construct" and even before "Event PreConstruct".

I hope someone could tell me how to setup a reference the right way.

Product Version: UE 4.19
more ▼

asked Jul 22 '18 at 02:28 PM in Blueprint Scripting

avatar image

0 1 1

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

0 answers: sort voted first
Be the first one to answer this question
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