Download

How to use Templated SpawnActor methods

I was reading this page: https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Actors/Spawning/index.html#spawntinstancewithtransform,returntpointer

And it has templated methods for spawning that look nice and convenient. It says sample usage:



Controller = SpawnActor<AController>(GetLocation(), GetRotation(), NULL, Instigator, true);


I can’t figure out how to get this to actually compile. It says SpawnActor is undefined.

I can spawn by calling the UWorld method just fine, but it’d be nice to use the convenient method too.

I think that doc is out of date, the template methods are in UWorld, so you’d use them like so:



Controller = GetWorld()->SpawnActor<AController>(GetLocation(), GetRotation());