-
Notifications
You must be signed in to change notification settings - Fork 0
Pooling.Pool
Andrés Eduardo Maldonado edited this page Jun 14, 2019
·
3 revisions
Public class from Pooling. Inherits from PoolBase
This is a generic class, and the core of the system. You can use this class to create your own managed pools.
public MyScript objectWithScript;
private Pooling.Pool<MyScript> myPool;
void Start()
{
myPool = new Pooling.Pool<MyScript>(objectWithScript);
}
public MyScript GetSpawn()
{
return myPool.PopFromPool(Vector3.zero, Quaternion.identity);
}
public Pool(T prefab, int initialQuantity = 1, bool preload = false)
Type | Argument | Description |
---|---|---|
T : Component | prefab | Reference to the original object. |
int | initialQuantity | Copies to preload. Only if preload is true. |
bool | preload | Activate the preloading with the set quantity. |
Type | Name | Description |
---|---|---|
T : Component | Prefab | The original reference. |
List | Actives | A list with the currently active objects. |
Returns | Name | Description |
---|---|---|
T:Component | PopFromPool | Sends an inactive or a new GameObject to the scene. |
void | PushToPool | Send a game object back into its pool. NOTE : Only Components that came from this pool can be repooled. |
void | PushToPoolLastest | Pushes back to pool the most recent object. |
void | PushToPoolAll | Repools all active objects. |