Spawn actor in c++

To spawn an actor in C++ you simply do this…

FVector location = FVector(*insert location here*);
		FRotator rotate = FRotator(*insert rotation here*);
		FActorSpawnParameters SpawnInfo;
		spawnedActor = World->SpawnActor<AMyActor>(AMyActor::StaticClass(), location, rotate, SpawnInfo);

Note the fourth line

spawnedActor = World->SpawnActor<AMyActor>(AMyActor::StaticClass(), location, rotate, SpawnInfo);

This saves the newly spawned actor in a variable called spawnedActor. You don’t have to save the actor into a variable if you don’t think you’ll need to access it later on. Hope this helps!