BreakPoint when opening Blueprint that inherits from a C++ ActorClass using UUserWidget

Hello everyone,

I created a Blueprint that inherits from a C++ class. This class is using a UUserWidget.

The code compiles and when I play the game, the UserWidget displays correctly.

The problem occurs when I try to open the Blueprint. A Break Point triggers and I get redirected to the UserWidget Class in VisualStudio. The attachment shows where the Break Point is exactly.

Any idea why? Thanks!

Hey MADMarkQc-

Can you post the source files for the class that sets up your widget as well as anything that was added to the blueprint. Also, if you’re running through Visual Studio debug mode can you try running the project from the .uproject and let me know if there is a crash when opening the blueprint. If there is please also post the callstack and log files from the crash for additional information.

Cheers

Doug Wilson

Hey Doug, thanks for the reply.

Here are 2 pictures of my source files that are using the UUserWidget. No includes are worth noting, but I added in MyGame.h those:

#include "Runtime/UMG/Public/UMG.h"
#include "Runtime/UMG/Public/UMGStyle.h"
#include "Runtime/UMG/Public/Slate/SObjectWidget.h"
#include "Runtime/UMG/Public/IUMGModule.h"
#include "Runtime/UMG/Public/Blueprint/UserWidget.h"

and in my Build.cs I added UMG, Slate and SlateCore as PublicDependancyModules.

I created a class based on actor and a blueprint from this class (as well as a widget blueprint). After copying the code above into my new class I ran in VS debug mode. Opening the blueprint based on my actor class did not cause a crash for me. Is there anything else setup in the blueprint itself or something I may have missed in my setup?

I was able to recreate the bug in a new 4.9.2 project. Here are the steps I did:

  1. Add the MyGame.h and DependancyModules needed
  2. Create an Actor Class and add the UserWidget related code lines
  3. Run Development Editor Mode in VS
  4. Create a Blueprint based on this Actor Class
  5. Put this Blueprint in the World
  6. Open Blueprint
  7. Breakpoint that redirects to VS and UserWidget class.

Following these steps I am still not getting a crash in 4.9.2. I first tried to add the two lines at the top of the constructor as well as the code inside BeginPlay(), since these are the places that reference your user widget, and then added the rest of the code from your screenshots to be safe. The only change I made was to “/Game/GUI/HUD/InteractWidget” so that it would reference a UserWidget Bluerpint I created in my project.

Since the only code related to your widget are in the constructor and BeginPlay you may want to move the lines from the constructor to the top of BeginPlay. This will remove the chance that your blueprint is trying to access information about your widget before it exists. If you’re still getting a crash please post the sample project you created so that I can take a look at the crash directly.

I tried to move the lines, but nothing changed. Here is a link to the Project:

Thanks for your help!

Hey MadMarkQc-

After further testing it appears that the crash is caused by the Static Mesh being inside the InteractVolume when the editor is opened. From what I can tell this is causing the overlap to be triggered and attempts to add the widget to the viewport when the viewport doesn’t exist. This has been bugged (UE-22777) for further investigation.

As a workaround you can set the static mesh and InteractVolume to ignore each other. The following process should allow you to open the blueprint normally:

  1. Open Project Settings and go to Engine-Collision
  2. Add a New Object Channel. This will be applied to the StaticMesh and and other components inside the volume
  3. Expand the Preset drop-down and add a new Preset. In the preset, set the newly created channel to Ignore
  4. In the source code, comment out the two “AddDynamic” lines in the constructor and compile
  5. After compile, open the blueprint and set the Static Mesh component’s Collision preset to Custom and the Object Type to your new Object Channel. Set the InteractionVolume’s Collision Preset to the new Preset
  6. Compile and save the blueprint
  7. In the source code, uncomment the AddDynamic lines and compile

After this your mesh and volume will ignore each other and should allow the blueprint to be opened properly.

Cheers

Doug Wilson

Yep, this workaround does the job.

Thanks Doug!