C# Класс UnityPooler.PoolableGameObject

This class is a required component for any prefab that is to be pooled
Наследование: UnityEngine.MonoBehaviour
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
capAmount int
onObjectCreation System.Action
persistAcrossScenes bool
releaseOnSceneTransition bool
useCap bool

Private Properties

Свойство Тип Описание
Awake void
Clear void
Initialize void
OnDestroy void
ReleaseObjects void
ReuseObject PoolableGameObject
SceneTransitioning void
SendCreationMessage void

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

AddToPool() публичный Метод

Adds 'numberToAdd' to the pool.
public AddToPool ( int numberToAdd ) : void
numberToAdd int Amount to add to the pool.
Результат void

AmountInPool() публичный Метод

Count of GameObjects currently in the pool.
public AmountInPool ( ) : int
Результат int

Get() публичный Метод

Returns an object from the pool
public Get ( ) : PoolableGameObject
Результат PoolableGameObject

IncrementPool() публичный Метод

Adds one object to the pool
public IncrementPool ( ) : void
Результат void

PopulatePool() публичный Метод

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.
Результат void

Release() публичный Метод

Releases an object back to the pool.
public Release ( ) : void
Результат void

ReleaseObjectsAndClearPool() публичный Метод

public ReleaseObjectsAndClearPool ( ) : void
Результат void

Описание свойств

capAmount публичное свойство

If there is a cap then what is that cap amount?
public int capAmount
Результат int

onObjectCreation публичное статическое свойство

Attach to be invoked when a new GameObject is created.
public static System.Action onObjectCreation
Результат System.Action

persistAcrossScenes публичное свойство

Should the pooled objects persist across scenes? Otherwise the pool is torn down when the next scene is loaded.
public bool persistAcrossScenes
Результат bool

releaseOnSceneTransition публичное свойство

If we persist across scenes then should all live objects be released back into the pool?
public bool releaseOnSceneTransition
Результат bool

useCap публичное свойство

Is there a cap for this pool?
public bool useCap
Результат bool