Asset store Usage
You can use quickpool in two ways:
- Create PoolManager and configure your pools with editor
- Or create a Pool field (in this case you will need to register your pool somewhere in Start with PoolManager.RegisterPool())
Include QuickPool namespace
using QuickPool;
You can use extention methods
var instance = somePrefab.Spawn(Vector3.zero, Quaternion.identity);
var component = somePrefab.Spawn<Component>(Vector3.zero, Quaternion.identity);
obj.Despawn();
You also can get concrete pool from PoolManager or use that one you have created
public Pool pool = new Pool()
{
size = 100,
allowGrowth = true
};
// OR
var pool = PoolManager.Instance["pool name"];
private void Start()
{
PoolsManager.RegisterPool(pool); //register pool if you want to use extention method Despawn
pool.Initialize();
var instance = pool.Spawn(Vector3.zero, Quaternion.identity);
var conponent = pool.Spawn<Component>(Vector3.zero, Quaternion.identity);
pool.Despawn(instance);
}
Despawn all spawned objects
PoolsManager.DespawnAll();
// OR
pool.DespawnAll();