Basic question, deferred-spawning an actor

Hi,

All I want to do is spawn an actor when the game starts. Because there’s barely any help anywhere on the internet, my best guess is to use StartPlay() within my GameMode. This code is supposed to ‘spawn’ this FuelTank; I haven’t set up any mesh, physics etc, I’m just trying to create the class behind it and initialise some values to begin with.

void ANocturnalSynergyGameMode::StartPlay()
{
	FTransform spawnArgs(ENoInit::NoInit);
	auto fuelTank = Cast<AFuelTank>(UGameplayStatics::BeginDeferredActorSpawnFromClass(GetWorld(), AFuelTank::StaticClass(), spawnArgs));

	fuelTank->Init(3);
	UGameplayStatics::FinishSpawningActor(fuelTank, spawnArgs);

	DebugHelper::Debug(fuelTank->GetI());

	delete fuelTank;
}

The compiler is complaining that GetWorld() is NULL, but I’ve been told all actors have access to GetWorld, and when BeginPlay’s called, obviously the world has to exist at that point.