March 2019
Intermediate to advanced
708 pages
17h 9m
English
We create the Spawn UFUNCTION and a variable called ActorToSpawn. The ActorToSpawnUPROPERTY is of the TSubclassOf< > type, a template type that allows us to restrict a pointer to either a base class or subclasses thereof. This also means that within the editor, we will get a pre-filtered list of classes to pick from, preventing us from accidentally assigning an invalid value:

Inside the Spawn function's implementation, we get access to our world. From here, we check it for validity.
SpawnActor wants an FTransform* to specify the location to spawn the new actor to, so we create a new stack variable to contain a copy of the current ...
Read now
Unlock full access