Finding Blueprint object by C++ works in Editor mode but not when launched

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;
	}

Here’s the main post that helped me: