-
Notifications
You must be signed in to change notification settings - Fork 4
Documentation
To create an object pool, simply add an ObjectPool component to any actor or use the Add Component by Class function.
- SpawnPoolObjectsOnBeginPlay - Specifies whether the pool should be filled at BeginPlay time. If false you have to fill it yourself during the game using AddActorsToPool function.
- PoolActorClass - Specifies what class of actors to be in the pool. It cannot be changed during the game.
-
InitialPoolSize - If the variable SpawnPoolObjectsOnBeginPlay is true, as many actors will be created as this variable is set to.
-
Add Actors to Pool
Adds the specified number of actors to the pool.
-
Spawn Actor from Pool
Returns and "spawns" an actor from the pool. If the pool is empty or all in use and the input variable "SpawnActorIfPoolIsEmpty" equals false the function will return nullptr.
This function: show an actor, enable collisions, and turns on tick.
-
Return Actor to Pool
Function that returns actor back to the pool.
This function: hide an actor, disable collisions, and turns off tick.
-
Get Active/Inactive Actors from Pool
Functions that returns array of active/inactive actors in the pool.
-
Has Pool Free Actor
Returns whether the pool has at least one free actor.
-
On Actor Spawned from Pool
Dispatcher, which is called each time an actor is pulled from the pool.
-
On Actor Returned to Pool
Dispatcher, which is called each time an actor returns to the pool and becomes inactive.
Interface can be added to the actor that is used in the pool. Called when the actor is Spawned/Despawned from the pool.