Code Reference‎ > ‎


PoolManager offers two optional events which you can use to manage the state of your instances as they spawn and despawn. All you have to do to use these events is add a function with the same name to your script, just like you would do to use Unity's Start().

To see a good example of what these look like in a script, and how they might be used, see the Example Pattern: Projectile Self-Destruct

Added in PoolManager 5.5.1...
There is now an example script showing these in action. The script is attached to the audio pool in the audio example scene as well.

OnDespawned and OnSpawned now have an optional argument: A reference to the SpawnPool which triggered the event. To ignore this argument, simply do not use it.

OnSpawned(SpawnPool pool)

returns: void

Runs last each time an instance is spawned. Use this to reset the state or initialize anything you need, start co-routines, etc.

OnDespawned(SpawnPool pool)

returns: void

Runs each time an instance is despawned. Use this for any clean-up or as a "post" event to run any last items before despawn