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"

UUserWidget* properties in custom Game Instance cause crash

The issue appears if there are any properties of UWidget* or UUserWidget* declared inside custom Game Instance C++ class in any form (directly, nested in ustructs, in arrays, maps etc.). When editing class defaults there is a standard option to select needed asset, but once pressed Compile the property gets cleared to none, once pressed Save, the editor crashes with stack overflow somewhere in UMG module.

I wasn't sure it was a bug, thinking that game instance constructor is called too early for UMG. Now I've solved the it by declaring the pointer as UObject* - this way the problem gone, the cost was an additional getter method and a much larger asset list for the edited property, i.e. risk of a wrong choise, so the problem still exists as a concept.

UPD: The workaround is not actually working. Though the pointers are edited, saved and available in code (debug uncovers them as usual objects) they turn null when using Cast() or they cause crash when using standard C/C++ typecast and then calling widget methods. So I'm still not sure whether this is a bug or something by design.

Product Version: UE 4.21
Tags:
more ▼

asked Apr 20 '19 at 11:13 PM in Using UE4

avatar image

Alakuloinen
6 1 2

avatar image Alakuloinen Apr 22 '19 at 08:30 AM

Okay, the problem is generally in the difference between Widget Blueprint and UUserWidget, so using TSubclassOF makes the container editable, but forces to use expicitly CreateWidget somewhere else.

Still I don't understand the mechanism. Previously I declared a bare UUserWidget* property in an APawn subclass, then assigned a widget in editor, then played in editor with no CreateWidget() and everything worked as if something is done under the hood in some classes and is not in the others.

(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