Actor Prefab Spawn Class Getter
About
Used by the Prefab Reference Component, these overridable objects allows you to control how a prefab actor class is selected when a PRC wants to spawn one.
Built-in classes
Here are the default available class getters, but keep in mind that you can make your own ones by doing BP or C++ subclasses!
> Base Prefab Spawn Class Getter (UPSActorPrefabSpawnClassGetterBase)
Cannot be directly used. Override this class to handle your project needs.
> Single Prefab Spawn Class Getter (UPSActorPrefabSpawnClassGetterSingle)
Returns the given single prefab actor class.

> Random Prefab Spawn Class Getter (UPSActorPrefabSpawnClassGetterRandom)
Returns a random prefab actor class from the given array.
This is useful when you need some randomness.

Preview Index and Force Preview Index in Game are used for editor previews only.
> Tag Map Prefab Spawn Class Getter (UPSActorPrefabSpawnClassGetterTagMap)
Selects a given prefab actor class from the tag set in Tag Spawn Prefab Parameters. This can be done in editor or at runtime.

> Random Tag Map Prefab Spawn Class Getter (UPSActorPrefabSpawnClassGetterRandomTagMap)
Selects a random prefab actor class from the tag set in Tag Spawn Prefab Parameters. This can be done in editor or at runtime.

How to use
Mandatory overrides are GetSoftPrefabClass (and GetSoftPrefabClasses if your are a container, see the function declaration).
If you are have bUseAsyncPath enabled, you have to override AsyncGetSoftPrefabClass and call the OnAsyncPrefabSpawnClassGetterFinished delegate. There is no async variant for GetSoftPrefabClasses because this is only used in editor and not at runtime.
IMPORTANT: bUseAsyncPath will be skipped if we are in editor OR if we are not doing an async spawn on the PRC. You HAVE to always implement the sync functions for fallback.
To make the editor work properly, you must also implement ClearSoftPrefabClass (see UPSActorPrefabSpawnClassGetterSingle and UPSActorPrefabSpawnClassGetterRandom for examples on how they work).
To get the owning PRC of this getter instance, see the GetLinkedPrefabReferenceComponent functions.
More details can be found in the source code.
Last updated