How do I spawn Blueprints?

I would like to know how to make this work.

 ConstructorHelpers::FObjectFinder<UClass> BlueprintObject(L"Blueprint'/Game/Blueprints/Blueprint_Effect_Explosion.Blueprint_Effect_Explosion'");			
    FActorSpawnParameters SpawnParams;
    SpawnParams.Instigator = Cast<APawn>(Owner);
    SpawnParams.bNoFail = true;
    GWorld->SpawnActor<UBlueprint>(BlueprintObject.Object, GetActorLocation(), FRotator(0, 0, 0), SpawnParams);

UObjectGlobals.cpp(2204): Fatal error:
FObjectFinders can't be used outside of constructors to find Blueprint'/Game/Blueprints/Blueprint_Effect_Explosion.Blueprint_Effect_Explosion'
UE4Editor.exe has triggered a breakpoint.

I would like to know how to make this work. The reference to the blueprint is correct. I have checked.

#Spawning Blueprints

I gave the world my SpawnBP template function to make doing this easy

#Wiki Tutorial

Rama

Ugh, please may I have an example of how to load the blueprints UClass* and call the function using that. Sorry. :confused:

Hi, Rama. I’m wondering how you get the actor blueprint. Are you doing it like this?:

 ConstructorHelpers::FObjectFinder<UBlueprint> BlueprintObj(TEXT("Blueprint'/Game/Blueprints/BP.BP'"));
 BPptr = NULL; /*UBlueprint* BPptr;*/
 if (BlueprintObj.Succeeded())
      BPptr = BlueprintObj.Object;

And then you’d pass in BPptr to this?:

 AActorBaseClass* NewActor = UFunctionLibrary::SpawnBP<AActorBaseClass>(GetWorld(), TheActorBluePrint, SpawnLoc, SpawnRot);

does it work?

What was left unclear to me is, where exactly do I put the function in? It syas I should put it in the .h file of the tepmlate, but in what kind of .h file do I put it in (actor, pawn, etc.) Thanks!