UniPool - Advanced Universal Prefab Pooling

FREE
Publisher DBCreative
File size 83.58kB
Number of files 29
Latest version 1
Latest release date 2024-08-14 10:41:12
First release date 2024-08-14 10:41:12
Supported Unity versions 2018.4.2 or higher

UniPool - Advanced Universal Prefab Pooling

provides a way to pool all kinds of prefabs into a single universal pool.

This allows to pool prefabs without dependencies, with a natural workflow, similar to Instantiate and Destroy.


Optimizations:

UniPool uses PoolCell object to cache GameObject, Transform

In addition, you may specify one Component type, located on prefab or in children, to be cached as well (including interface type).

This is so you can avoid unnecessary (costly at scale) calls to .GetComponent; .gameObject; transform;


Use features:

Get - get object from pool,

with or without prior registration (can be fully dynamic)


Registration - may choose to register a prefab before use (by prefab or string name)


Fill - can instantiate an amount of prefabs to pool


Release - releases object back to pool. Release can be done by passing a reference, any of: PoolCell, GameObject, Transform, Component.


UGUI object pooling - Pooling works for regular 3D objects and UI objects alike.


Custom container - can specify what object to use as a pool container for each particular prefab



Example code:


PoolCell cell = UniPool.Get(prefab);


PoolCell cell = UniPool.Get("registeredName");


PoolCell cell = UniPool.Get<T>(prefab);


cell.gameObject; // cached gameObject

cell.transform; // cached transform

cell.GetComponent<T>(); // retrieves cached component reference


// Plain prefab.

UniPool.Register(prefab);


// Prefab with component caching of specified type T

// attach string name, that can be used to Get("prefab") via string name

UniPool.Register<T>(prefab, "prefab");


// Release by passing any of: PoolCell, Transform, GameObject, Component

UniPool.Release(transform);


Top Publisher Assets