-
Notifications
You must be signed in to change notification settings - Fork 3
Documentation
How to setup UnityObjectPooler in your Unity project?
Add ObjectPool.cs to your project assets folder.
Use the ObjectPool's static methods
ObjectPool can be accessed at all times.
ObjectPool.Clear();
// Clears the pool (should be used on scene reload or new scene load because its static)
ObjectPool.Add(poolable);
// Takes IPoolable type so any class that inherits IPoolable interface can be passed
ObjectPool.Get<yourtype>();
// Will return one of your type from the pool (null if none in the pool)
ObjectPool.GetCustom<yourtype>(customlambda);
// This will return your IPoolable to the type passed if one is found based on your custom lambda criteria
ObjectPool.GetAmountInPool<yourtype>();
// Retrieves an int based on how many of this type are in the pool