How to spawn actor in C++? Been trying for 9 hours now

It’s really this easy:

FVector Location(0.0f, 0.0f, 0.0f);
FRotator Rotation(0.0f, 0.0f, 0.0f);
FActorSpawnParameters SpawnInfo;
GetWorld()->SpawnActor<AProjectile>(Location, Rotation, SpawnInfo);

And don’t forget to #include the thing you’re trying to spawn.

8 Likes