It's incredible easy to get up and running with SmartPool. Just perform these three simple steps:

  1. Add a SmartPool component to a gameObject of your choice
  2. Define a Pool Name. This Name will be used to interact with the pool, e.g. to spawn items
  3. Link to a Prefab. This Prefab will be used when spawning items


Once your SmartPool is set up, you can use it from your code:

Spawning an item:

var myBullet=SmartPool.Spawn("Bullet");

Despawning an item:


That's it!

Component Reference

  • Pool Name identifies the pool and should be unique
  • Prefab links to the Prefab the pool should manage
  • Don't Destroy should be checked to keep the pool persistent between scene changes
  • PrepareAtStart tells the pool to fill itself when the game starts. If unchecked, you'll need to call Prepare() manually
  • Allocation Block Size is the number of objects beeing instantiated or destroyed in bulk when the pool needs to grow or shrink
  • Min Pool Size is the minimum number of objects that should be prepared by this pool
  • Max Pool Size is the maximum number of objects a pool should hold
  • On Max Pool Size determines the pool's behaviour when its reached the maximum pool size:
    • Ignore Max Pool Size and create more objects when necessary
    • Stop Spawning and return Null when Spawn() is called and the pool is exceeded
    • ReUse an already spawned object (the oldest, i.e. the first spawned) and return that when Spawn() is called
  • Auto Cull will shrink the pool down to Max Pool Size - depending on the setting of OnMaxPoolSize
  • Culling Speed determines the time in seconds between two automatic cullings
  • Debug Log should be checked to get detailed activity logs printed to the console
  • In Stock / Spawned gives a brief overview about how many objects are in the pool or spawned

Class Reference

Static Class Methods (for referenceless SmartPool access)

  • Prepare (poolName) to fill a pool (usually called automatically)
  • Cull (poolName) to remove items from the pool
  • Spawn (poolName) to spawn an item
  • Despawn (item) to despawn an item
  • DespawnAllItems (poolName) to despawn all items managed by a pool
  • Kill (item) to remove an item from the pool and destroy it
  • GetPoolByItem (item) to find a pool an item belongs to
  • GetPoolByName (poolName) to get a reference to a pool

Class Methods (for direct SmartPool access):

  • Prepare() to fill a pool
  • Cull() to remove items from the pool
  • SpawnItem() to spawn an item
  • DespawnItem() to despawn an item
  • KillItem() to remove an item from the pool and destroy it
  • IsManagedObject (item) to see if an item is managed by the pool
  • IsSpawned (item) to see if an item is managed by the pool and currently spawned
Last modified: 2015/07/29 20:33 by Jake