Spawn Class Instance with Transform, Return T Pointer
This function template spawns an instance of the specified
Class at the specified
Location and with the specified
Rotation, and returns a pointer to that instance of the same type as the
template class, i.e.
T*. This requires that the specified
Class be a child of the template class
T. In addition to the class, location, and rotation, the owning Actor, instigating
Pawn, and whether the spawn operation should fail if the spawned Actor encroaches, or would be colliding with, another Actor already present in the world can be specified.
/** Spawns given class and returns class T pointer, forcibly sets world position. */
template< class T >
FVector const& Location,
FRotator const& Rotation,
return (Class != NULL) ? Cast<T>(GetWorld()->SpawnActor(Class, NAME_None, &Location, &Rotation, NULL, bNoCollisionFail, false, Owner, Instigator)) : NULL;