I’ve tried following several guides however I can not get it to work at all.
In my Helicopter3DGameMode.h I have:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Classes)
TSubclassOf<class ABasicTile> BasicTileBPClass;
I then have a blueprint child game mode, Helicopter3DGameMode_BP.h where I have set the BasicTileBPClass to be BasicTile_BP which is a blueprint child of ABasicTile.
In Helicopter3DGameMode.cpp I have:
AHelicopter3DGameMode::AHelicopter3DGameMode()
{
Tiles = TArray<ABasicTile*>();
if (BasicTileBPClass != nullptr)
{
FActorSpawnParameters SpawnParams;
SpawnParams.bNoCollisionFail = true;
auto NewTile = GetWorld()->SpawnActor<ABasicTile>(BasicTileBPClass, SpawnParams);
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::, TEXT("BasicTileBPClass is null"));
}
}
I made sure to set the default game mode to my Helicopter3DGame_BP in the maps and modes settings however every time I run the game BasicTileBPClass is null despite being set in the blueprint editor. What am I doing wrong?