SpawnActor with FActorSpawnParameters template crashes

I am able to use SpawnActor to spawn the actor I want, but it spawns with the default values for the class. In order to give the actor the values it needs, I thought I should use FActorSpawnParameters and give it a template from another instance of the class that’s already in the scene. Here’s the code:

//.cpp
void ANaziSpawner::BeginPlay()
{
	FActorSpawnParameters params;
        params.Template = templateNazi;
	params.bAllowDuringConstructionScript = true;
        ANazi* spawnedNazi = ()->SpawnActor<ANazi>(templateNazi->GetClass(), GetActorLocation(), GetActorRotation(), params);
}

//.h
UPROPERTY(EditAnywhere)
		AActor* templateNazi;

If I take out the params in SpawnActor, it works completely smoothly. As is, it compiles but causes the client to crash when I try to play. I can find a way to work without using FActorSpawnParameters in the SpawnActor, but it would be very useful if I can get this to work.

I gonna give you universal anwser for all the crashes. If something crashes check the logs, in stack dump and also in above it, usally there information want wrong if engine managed to detect that, also look on stack dump and see on which line exacly it crashed in engine, it can be hint too. Most crashes are controlled crashes where engine detect issue and write information in log and crash on it own. But if you have uncontrolled crash end engine didn’t log anything, you need to do debug in VS, when crash happens VS will point youy where it happened.

My guess is it might be null value somewhere