I need to spawn BP, that gonna be set in variable later, when actor will be placed in world.
I need to have opportunity to move this actor to world, then set a StartRoom, and spawn it on begin play.
.h
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Defaults)
TSubclassOf<class ARoom> StartRoom;
.cpp
void ARandom::BeginPlay()
{
Super::BeginPlay();
UWorld* const World = GetWorld();
if (World)
{
ARoom* SpawnedRoom = World->SpawnActor<ARoom>(StartRoom, GetActorLocation(), GetActorRotation());
}
}
It giving errors:
Error 4 error C2027: use of undefined type ‘ARoom’ E:\Development\Unreal Engine\Epic Games\4.7\Engine\Source\Runtime\CoreUObject\Public\UObject\Class.h 2517
Error 5 error C3861: ‘StaticClass’: identifier not found E:\Development\Unreal Engine\Epic Games\4.7\Engine\Source\Runtime\CoreUObject\Public\UObject\Class.h 2517
P.s. Sorry for my English