Libraries

s&box libraries

Object Pools

hotpot.objectpools

Just a regular list based object pool.

About

Example
using ObjectPools;

public sealed class TestObjectPool : Component
{
[Property] private GameObject prefab { get; set; }

private ObjectPool<GameObject> _pool;

protected override void OnStart()
{
_pool = new ObjectPool<GameObject>(
OnCreate,
OnGet,
OnRelease,
OnDestroy,
defaultCapacity: 10,
maxAmount: 10000,
collectionCheck: true);
}

GameObject OnCreate()
{
return prefab.Clone();
}

void OnGet(GameObject obj)
{
obj.Enabled = true;
}

void OnRelease(GameObject obj)
{
obj.Enabled = false;
}

void OnDestroy(GameObject obj)
{
obj.Destroy();
}
}

objectpoolpooling

More by hotdawg

01
Chit Chat Dialogue System thumbnail
Chit Chat Dialogue System hotpot.chitchat

A simple system to create dialogue with a custom editor!

dialoguelibrarytool
+0 24h
5favorites
4upvotes
51%Wilson score