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.
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.
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?
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.
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:
Open Project Settings and go to Engine-Collision
Add a New Object Channel. This will be applied to the StaticMesh and and other components inside the volume
Expand the Preset drop-down and add a new Preset. In the preset, set the newly created channel to Ignore
In the source code, comment out the two “AddDynamic” lines in the constructor and compile
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
Compile and save the blueprint
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.