Hi,
Nobody seems to be answering my simple questions and my last question disappeared for no reason.
All I need to know is something very simple so I can actually start creating this game and stop trying to climb over pointless hurdles.
In my GameMode, I cannot figure out how to deferred-spawn an actor. That is, create the object, and make the thing visible in the world later, giving time to initialise variables and do some calculations first.
void ANocturnalSynergyGameMode::StartPlay()
{
FTransform spawnArgs(ENoInit::NoInit);
auto fuelTank = Cast<AFuelTank>(UGameplayStatics::BeginDeferredActorSpawnFromClass((), AFuelTank::StaticClass(), spawnArgs));
// do anything here
UGameplayStatics::FinishSpawningActor(fuelTank, spawnArgs);
delete fuelTank;
}
All this should do is construct it with no position or rotation, hence ENoInit::NoInit, do anything to the object, then spawn it into the world. The issue is that () returns NULL and just crashes UE4. I’ve seen people talking about doing this in the ‘level’, but there’s no file with anything to do with levels, I start the game and the level is just there.