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"

[Repro] Adding UUserWidget To Viewport on BeginPlay Causes Crash On Clients

This occurs in Older builds of the engine as well, as far back as when UUserWidget was even a thing (4.5 I believe)

On BeginPlay in my HUD, I'm creating some widgets and attempting to add them to the Viewport. If I do this, any client that I run in the editor AND in a standalone game causes a crash at Actor->GetWorld(). I previously did this in Blueprint, and had to use a Delay node to prevent this crash from happening.

I suspect this is because it's trying to get a World from the PlayerController I'm passing in, whereby the World may not exist yet.

In C++, I'm now forced to create a timer to delay the creation of the widgets, to make sure there is enough time for the World to be created. This seems to be a fundamental issue with the way in which UserWidgets are never bound to a world (indeed, they remain in the viewport even if the game has moved to a different level entirely).

I would have thought this is a pretty regular place for people to want to create Widgets, at the start of the game - so this has to be a bug right? Anything I need to do at the start of the game for my widgets ALSO has to be delayed, so this isn't a very nice workflow.

This bug report is also linked to previous reports I have made, which have gone unresolved for now (I now have a reliable repro). https://answers.unrealengine.com/questions/166546/repro-using-umg-causes-garbage-collection-crash-on.html https://answers.unrealengine.com/questions/202764/server-travel-doesnt-remove-existing-viewport-widg.html

Here is the code I'm using (In my HUD class) to spawn my Widgets. The same behaviour can be achieved using Blueprints too. Simply create a user widget (pass in Owning Playing) and add it to viewport on Begin Play in the HUD - then start a multiplayer game in the editor.

 void ABZGame_InGameHUD::BeginPlay()
     OwningBZPlayer = Cast<ABZGame_PlayerController>(GetOwningPlayerController());
 void ABZGame_InGameHUD::CreateGameWidgets()
     if (OwningBZPlayer)
         ActiveGameWidget = CreateWidget<UBZGame_InGameWidget>(OwningBZPlayer, GameWidget);
         if (ActiveGameWidget)
Product Version: UE 4.8 Preview
more ▼

asked May 30 '15 at 12:33 PM in C++ Programming

avatar image

820 60 97 140

avatar image Rudy Q ♦♦ STAFF Jun 02 '15 at 01:40 PM

Hello TheJamsh,

I was unable to reproduce this issue in blueprints with the information provided. I would like to get a set of steps with blueprints only if possible (there is a current issue dealing with widgets made in C++) to eliminate any extraneous factors.

If this is not possible I will be more than happy to try and reproduce this using code.

Quick questions:

  1. Can you reproduce this issue in a clean project?

  2. If so, could you provide a more detailed list of steps in order to reproduce this issue on our end?

  3. Could you provide screen shots of the blueprints involved?

  4. Could you provided the crash that you get?

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

1 answer: sort voted first

Hello TheJamsh,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.

more ▼

answered Jun 08 '15 at 06:38 PM

avatar image

Rudy Q ♦♦ STAFF
47.4k 545 132 525

(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