PoolGen  1.0
Public Member Functions | Properties | List of all members
ObjectPool Class Reference

Handles the pooling of objects. It will apply a PoolUser to each of its pooled objects. More...

Public Member Functions

void ClearAll ()
 Destroys all pooled and spawned objects More...
 
void Despawn (PoolUser user)
 Despawns a PoolUser More...
 
void Despawn ()
 Despawns the oldest spawned object More...
 
void DespawnAll ()
 Despawns all objects More...
 
void Initialize ()
 Sets up the necessary variables and fills the object pool More...
 
GameObject Instantiate ()
 Instantiates an object for usage with the pool with default position and rotation More...
 
GameObject Instantiate (Vector3 position, Quaternion rotation)
 Instantiates an object for usage with the pool More...
 
PoolUser Pool ()
 Attempts to add an object to the pool then returns it. If the pool is full then it returns null. More...
 
void PoolCount (int count)
 Attempts to pool a specified amount of objects More...
 
PoolUser Spawn ()
 Attempts to spawn an object from the pool with default position and rotation More...
 
PoolUser Spawn (Vector3 position, Quaternion rotation)
 Attempts to spawn an object from the pool More...
 

Properties

int CapacityLeft [get]
 How many spawned objects can fit back into the pool More...
 
bool IsNetworked [get]
 Will the object pool use Unity's networking system. Should be set before the object pool is initialized (or before objects are first pooled). If true, Despawn and Spawn can only be called by the Host (on the Server). More...
 
bool IsPoolFull [get]
 If true, the TotalCount is equal or greater than the PoolPrefab.PoolSize and it cannot expand More...
 
bool IsPoolOverflowing [get]
 If true, the TotalCount is greater than the PoolPrefab.PoolSize and it cannot expand More...
 
PoolManager PoolManagerComponent [get, set]
 The PoolGen.PoolManager that this ObjectPool belongs to More...
 
Stack< PoolUserPooledObjects [get, set]
 A stack of pooled objects. Takes advantage of Stack{T} for better memory usage. More...
 
PoolPrefab PoolPrefab [get]
 PoolGen.PoolPrefab data from the PoolManagerComponent More...
 
int PrefabID [get]
 ID of the PoolGen.PoolPrefab More...
 
int PrefabIndex [get, set]
 Index of the PoolGen.PoolPrefab in PoolManagerComponent More...
 
List< PoolUserSpawnedObjects [get, set]
 List of spawned PoolUsers More...
 
int TotalCount [get]
 Total number of pooled and spawned objects More...
 

Detailed Description

Handles the pooling of objects. It will apply a PoolUser to each of its pooled objects.

Member Function Documentation

void ClearAll ( )

Destroys all pooled and spawned objects

void Despawn ( PoolUser  user)

Despawns a PoolUser

void Despawn ( )

Despawns the oldest spawned object

void DespawnAll ( )

Despawns all objects

void Initialize ( )

Sets up the necessary variables and fills the object pool

GameObject Instantiate ( )

Instantiates an object for usage with the pool with default position and rotation

GameObject Instantiate ( Vector3  position,
Quaternion  rotation 
)

Instantiates an object for usage with the pool

PoolUser Pool ( )

Attempts to add an object to the pool then returns it. If the pool is full then it returns null.

void PoolCount ( int  count)

Attempts to pool a specified amount of objects

PoolUser Spawn ( )

Attempts to spawn an object from the pool with default position and rotation

PoolUser Spawn ( Vector3  position,
Quaternion  rotation 
)

Attempts to spawn an object from the pool

Property Documentation

int CapacityLeft
get

How many spawned objects can fit back into the pool

bool IsNetworked
get

Will the object pool use Unity's networking system. Should be set before the object pool is initialized (or before objects are first pooled). If true, Despawn and Spawn can only be called by the Host (on the Server).

bool IsPoolFull
get

If true, the TotalCount is equal or greater than the PoolPrefab.PoolSize and it cannot expand

bool IsPoolOverflowing
get

If true, the TotalCount is greater than the PoolPrefab.PoolSize and it cannot expand

Stack<PoolUser> PooledObjects
getset

A stack of pooled objects. Takes advantage of Stack{T} for better memory usage.

PoolManager PoolManagerComponent
getset

The PoolGen.PoolManager that this ObjectPool belongs to

int PrefabID
get

ID of the PoolGen.PoolPrefab

int PrefabIndex
getset
List<PoolUser> SpawnedObjects
getset

List of spawned PoolUsers

int TotalCount
get

Total number of pooled and spawned objects