crash using static ConstructorHelpers::FObjectFinder

Hello everyone,
I’m a beginner in Unreal Engine and now I’m trying to Learn C++ Programming from the documentation.
from the following link, I did the Programming Quick Start and Game-Controlled Cameras.
link:https://docs.unrealengine.com/5.1/en-US/unreal-engine-cpp-programming-tutortials/

Now I’m following the Components and Collision tutorial using UE5.1.1.
I’ve done the first part and when I build the script with Live Coding, Unreal Crash at the following line:

static ConstructorHelpers::FObjectFinder SphereVisualAsset(TEXT(“/Game/Props/Shape_Sphere.Shape_Sphere”));

My project does have the StarterContent, I’ve tried to change Shape_Sphere.Shape_Sphere to Shape_Cube.Shape_Cube like the QuickStart tutorial but still crash. Commenting this part of the code, I’m able to compile and have not issue with static ConstructorHelpers::FObjectFinder.
One thing to note is that when I copy Shape_Sphere to /Content/Props folder for example, crash doesn’t occur with the following line:

static ConstructorHelpers::FObjectFinder SphereVisualAsset(TEXT(“/Game/Props/Shape_Sphere.Shape_Sphere”));

Can you please tell me why this project crash when trying to load a static mesh from the StarterContent folder?

I really thank you for your help.

Best regards

edit:Attached crash log
ProgHowTo_Components.log (120.2 KB)

Make absolutely sure that your path is correct. Browse to the object you want to construct in the editor, right click and click “copy path” or whatever it’s called, and make sure you’re using the right path.

Also, when you crash, Unreal Engine should give you a crash dialog. It would be very helpful if you post whatever it says here as well.

1 Like

Hello
Thank you for your reply.

Not sure what’s going on but yesterday, I was able to compile, drag my pawn to the level and test it.
This morning when I loaded my project, I had the following error in the message log:

CreateExport: Failed to load Outer for resource ‘RootComponent’: CollidingPawn /Game/Maps/HowTo_Components.HowTo_Components:PersistentLevel.CollidingPawn_1

and my class didn’t show up in the content browser. I try to recompile without editing the script and crash occurred.

I’ve tried to change to path by right clicking of the asset, chose “copy reference” and paste it.
Now my FObjectFinder looks like below:

static ConstructorHelpers::FObjectFinder SphereVisualAsset(TEXT(“/Script/Engine.StaticMesh’/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere’”));

with this change I was able to compile and put the pawn in the level and test it.
However when I close the project and reopen it, I got the same CreateExport : failed to load Outer… log and when I try to compile, it crashes again.

I don’t know if it is important but when creating my class, I made it public, so my header is in ~/Public folder and my CPP is in the ~/private folder

I’m attaching my header/CPP file, the content of the crash reporter, CrashContext.runtime-xml, the crash log and dmp file.
Hoping to find the issue.

Thank you very much for your help
crash_reporter.txt (320 Bytes)
CrashContext.runtime-xml (148.0 KB)
ProgHowTo_Components.log (118.3 KB)
UEMinidump.dmp (945.5 KB)
CollidingPawn.h (1.3 KB)
CollidingPawn.cpp (6.1 KB)

It seams that the issue is related to Live Coding.
Closing Unreal, open the visual studio solution, build and running from Visual Studio fixed the issue.