I made a projectile class, which is basically for now the same thing as the projectile in the twin stick shooter demo project. I then made a blueprint that derived from it. I’d like to be able to spawn this blueprint but every time I try to do a SpawnActor it returns NULL. In the header of the file I’m trying to do this in, I have declared:
class UBlueprint* HeavyProjectileActor;
In the constructor for it, I have:
struct FConstructorStatics
{
ConstructorHelpers::FObjectFinder<UBlueprint> HeavyProjectileRef;
FConstructorStatics() :
HeavyProjectileRef(TEXT("Blueprint'/Game/Blueprints/B_Heavy_Projectile.B_Heavy_Projectile'"))
{
}
};
static FConstructorStatics ConstructorStatics;
HeavyProjectileActor = ConstructorStatics.HeavyProjectileRef.Object;
And in the part where I’m trying to spawn the actor I do this:
AActor* a = World->SpawnActor(HeavyProjectileActor->GetClass(), &SpawnLocation, &FireRotation);
(SpawnLocation and FireRotation are set up above it). The projectile is never added and the return result from SpawnActor is NULL.
My guess is I screwed up how I’m trying to get the blueprint reference. Please note that when I break at that line and view the contents of HeavyProjectileActor it’s not NULL and appears to be populated with valid data.