C# Class UnityPooler.PoolableGameObject

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

Méthodes publiques

Свойство Type Description
capAmount int
onObjectCreation System.Action
persistAcrossScenes bool
releaseOnSceneTransition bool
useCap bool

Private Properties

Свойство Type Description
Awake void
Clear void
Initialize void
OnDestroy void
ReleaseObjects void
ReuseObject PoolableGameObject
SceneTransitioning void
SendCreationMessage void

Méthodes publiques

Méthode 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

Méthode 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 méthode

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

AmountInPool() public méthode

Count of GameObjects currently in the pool.
public AmountInPool ( ) : int
Résultat int

Get() public méthode

Returns an object from the pool
public Get ( ) : PoolableGameObject
Résultat PoolableGameObject

IncrementPool() public méthode

Adds one object to the pool
public IncrementPool ( ) : void
Résultat void

PopulatePool() public méthode

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.
Résultat void

Release() public méthode

Releases an object back to the pool.
public Release ( ) : void
Résultat void

ReleaseObjectsAndClearPool() public méthode

public ReleaseObjectsAndClearPool ( ) : void
Résultat void

Property Details

capAmount public_oe property

If there is a cap then what is that cap amount?
public int capAmount
Résultat int

onObjectCreation public_oe static_oe property

Attach to be invoked when a new GameObject is created.
public static System.Action onObjectCreation
Résultat 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
Résultat bool

releaseOnSceneTransition public_oe property

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

useCap public_oe property

Is there a cap for this pool?
public bool useCap
Résultat bool