加载蓝图资源
void ALPCController::GenerateRainEffectBp()
{
UObject* loadObj = StaticLoadObject(UBlueprint::StaticClass(), NULL, TEXT("Blueprint'/Game/Camera/PostProcess/Bp/Bp_RainEffect.Bp_RainEffect'"));
if (loadObj)
{
UBlueprint* ubp = Cast<UBlueprint>(loadObj);
FRotator myRot(0, 0, 0);
FVector myLoc(-3000, -3000, -3000);
FActorSpawnParameters SpawnParams;
ARainEffectController* spawnActor = GetWorld()->SpawnActor<ARainEffectController>(ubp->GeneratedClass, myLoc, myRot, SpawnParams);
RainBpActor = spawnActor;
//UE_LOG(LogClass, Log, TEXT("Spawn RainBp Success"));
}
}
场景中按照名字查找某个Actor
ARainEffectController* ALPCController::FindRainEffect()
{
TActorIterator<AActor> actorItr = TActorIterator<AActor>(GetWorld());
for (actorItr; actorItr; ++actorItr) {
if (actorItr) {
if (actorItr->GetName() == "Bp_RainEffect") {