Tanks Multiplayer  1.5
Static Public Member Functions | List of all members
PoolManager

This class provides networked object pooling functionality and stores all Pool references. Spawning and despawning is handled by calling the corresponding methods, but there are also methods for creating Pools at runtime or destroying all gameobjects in a Pool completely. More...

Inheritance diagram for PoolManager:

Static Public Member Functions

static void Add (Pool pool)
 Called by each Pool on its own, this adds it to the dictionary. More...
 
static void CreatePool (GameObject prefab, int preLoad, bool limit, int maxCount)
 Creates a new Pool at runtime. This is being called for prefabs which have not been linked to a Pool in the scene in the editor, but are called via Spawn() nonetheless. More...
 
static GameObject Spawn (GameObject prefab, Vector3 position, Quaternion rotation)
 Activates a pre-instantiated instance for the prefab passed in, at the desired position. More...
 
static void Despawn (GameObject instance, float time=0f)
 Disables a previously spawned instance for later use. Optionally takes a time value to delay the despawn routine. More...
 
static Pool GetPool (GameObject instance)
 Convenience method for quick lookup of an pooled object. Returns the Pool component where the instance has been found in. More...
 
static void DeactivatePool (GameObject prefab)
 Despawns all instances of a Pool, making them available for later use. More...
 
static void DestroyAllInactive (bool limitToPreLoad)
 Destroys all despawned instances of all Pools to free up memory. The parameter 'limitToPreLoad' decides if only instances above the preload value should be destroyed, to keep a minimum amount of disabled instances More...
 
static void DestroyPool (GameObject prefab)
 Destroys the Pool for a specific prefab. Active or inactive instances are not available anymore after calling this. More...
 
static void DestroyAllPools ()
 Destroys all Pools stored in the manager dictionary. Active or inactive instances are not available anymore after calling this. More...
 

Detailed Description

This class provides networked object pooling functionality and stores all Pool references. Spawning and despawning is handled by calling the corresponding methods, but there are also methods for creating Pools at runtime or destroying all gameobjects in a Pool completely.

Member Function Documentation

static void Add ( Pool  pool)
static

Called by each Pool on its own, this adds it to the dictionary.

static void CreatePool ( GameObject  prefab,
int  preLoad,
bool  limit,
int  maxCount 
)
static

Creates a new Pool at runtime. This is being called for prefabs which have not been linked to a Pool in the scene in the editor, but are called via Spawn() nonetheless.

static void DeactivatePool ( GameObject  prefab)
static

Despawns all instances of a Pool, making them available for later use.

static void Despawn ( GameObject  instance,
float  time = 0f 
)
static

Disables a previously spawned instance for later use. Optionally takes a time value to delay the despawn routine.

static void DestroyAllInactive ( bool  limitToPreLoad)
static

Destroys all despawned instances of all Pools to free up memory. The parameter 'limitToPreLoad' decides if only instances above the preload value should be destroyed, to keep a minimum amount of disabled instances

static void DestroyAllPools ( )
static

Destroys all Pools stored in the manager dictionary. Active or inactive instances are not available anymore after calling this.

static void DestroyPool ( GameObject  prefab)
static

Destroys the Pool for a specific prefab. Active or inactive instances are not available anymore after calling this.

static Pool GetPool ( GameObject  instance)
static

Convenience method for quick lookup of an pooled object. Returns the Pool component where the instance has been found in.

static GameObject Spawn ( GameObject  prefab,
Vector3  position,
Quaternion  rotation 
)
static

Activates a pre-instantiated instance for the prefab passed in, at the desired position.


The documentation for this class was generated from the following file: