C# Class UnityPooler.PoolableGameObject

This class is a required component for any prefab that is to be pooled
Inheritance: UnityEngine.MonoBehaviour
显示文件 Open project: GalvanicGames/unity-pooler Class Usage Examples

Public Properties

Property Type Description
capAmount int
onObjectCreation System.Action
persistAcrossScenes bool
releaseOnSceneTransition bool
useCap bool

Private Properties

Property Type Description
Awake void
Clear void
Initialize void
OnDestroy void
ReleaseObjects void
ReuseObject PoolableGameObject
SceneTransitioning void
SendCreationMessage void

Public Methods

Method Description
AddToPool ( int numberToAdd ) : void

Adds 'numberToAdd' to the pool.

AmountInPool ( ) : int

Count of GameObjects currently in the pool.

Get ( ) : PoolableGameObject

Returns an object from the pool

IncrementPool ( ) : void

Adds one object to the pool

PopulatePool ( int numberToPopulate ) : void

Populates the pool up to 'numberToPopulate' will not add to the pool past that count.

Release ( ) : void

Releases an object back to the pool.

ReleaseObjectsAndClearPool ( ) : void

Private Methods

Method Description
Awake ( ) : void
Clear ( ) : void

Completely resets the pool. Live objects are on their own but pooled objects will be destroyed.

Initialize ( ) : void
OnDestroy ( ) : void
ReleaseObjects ( ) : void
ReuseObject ( ) : PoolableGameObject
SceneTransitioning ( Scene from, Scene to ) : void
SendCreationMessage ( PoolableGameObject newObj ) : void

Method Details

AddToPool() public method

Adds 'numberToAdd' to the pool.
public AddToPool ( int numberToAdd ) : void
numberToAdd int Amount to add to the pool.
return void

AmountInPool() public method

Count of GameObjects currently in the pool.
public AmountInPool ( ) : int
return int

Get() public method

Returns an object from the pool
public Get ( ) : PoolableGameObject
return PoolableGameObject

IncrementPool() public method

Adds one object to the pool
public IncrementPool ( ) : void
return void

PopulatePool() public method

Populates the pool up to 'numberToPopulate' will not add to the pool past that count.
public PopulatePool ( int numberToPopulate ) : void
numberToPopulate int Amount to bring the pool up to.
return void

Release() public method

Releases an object back to the pool.
public Release ( ) : void
return void

ReleaseObjectsAndClearPool() public method

public ReleaseObjectsAndClearPool ( ) : void
return void

Property Details

capAmount public_oe property

If there is a cap then what is that cap amount?
public int capAmount
return int

onObjectCreation public_oe static_oe property

Attach to be invoked when a new GameObject is created.
public static System.Action onObjectCreation
return System.Action

persistAcrossScenes public_oe property

Should the pooled objects persist across scenes? Otherwise the pool is torn down when the next scene is loaded.
public bool persistAcrossScenes
return bool

releaseOnSceneTransition public_oe property

If we persist across scenes then should all live objects be released back into the pool?
public bool releaseOnSceneTransition
return bool

useCap public_oe property

Is there a cap for this pool?
public bool useCap
return bool