Skip to content

jeffvella/UnityObjectPooler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

UnityObjectPooler

Simple object pool for Unity

This is a quick and lightweight solution that you can just immediately throw objects at to be pooled. (.Net 4.6+)

  • No need to pre-define pools (although you can if you want).
  • Calls Spawn/Despawn interface
  • Neatly organized in project hierarchy
Instantiating objects (taking them from the pool):
var obj = ObjectPooler.Instance.Spawn(prefab, position, rotation);
Destroying objects (adding them back into the pool):
ObjectPooler.Instance.Despawn(gameObject);   
Preparing objects for re-use.
public class Enemy : MonoBehaviour, IPoolable
{
    public void Spawn()
    {
        // do stuff...
    }

    public void Despawn()
    {
        // do stuff...
    }
}

About

Simple object pool for Unity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages