Spawning the object works just as expected when I play in the editor but when I try to launch I immediately get an error dialogue box stating it could not be located. The value I am using in the text field is what I get when I right-click the Blueprint object in the Content Browser and select “copy reference”. Is there another value I should be using to get the proper behavior when I launch the program? And why does it work in Editor mode?
This might be a bit late but this was my first google hit and I was able to figure this out from a few other posts. The issue is UBlueprints are not supposed to be used in C++ outside of the editor in general. It looks like Unreal Engine 4.x had a setting for enabling packaging blueprint files but I didn’t see that in 5.x. Regardless, the correct solution seems to be to load the corresponding UClass file for the blueprint instead of the blueprint itself. They have a “_C” suffix after the blueprint’s name so you would change your code above to this:
static ConstructorHelpers::FObjectFinder<UClass> ABotClassFinder(TEXT("Class'/Game/Blueprints/Pawns/MyPawn.MyPawn_C'"));
if (ABotClassFinder.Object) {
Ashooterplayer_BP = ABotClassFinder.Object;
}