C# Класс ObjectPool, SimpleObjectPool

Наследование: MonoBehaviour
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
DefaultContainer Transform
Entries ObjectPoolEntry[]

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

Метод Описание
Awake ( ) : void
GetObjectForPrefab ( GameObject prefabGameObject, bool onlyPooled ) : GameObject

Gets a new object for the name type provided. If no object type exists or if onlypooled is true and there is no objects of that type in the pool then null will be returned.

GetPoolEntryForPrefab ( GameObject prefab ) : ObjectPoolEntry

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

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

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

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

Gets a new object for the name type provided. If no object type exists or if onlypooled is true and there is no objects of that type in the pool then null will be returned.
public GetObjectForPrefab ( GameObject prefabGameObject, bool onlyPooled ) : GameObject
prefabGameObject GameObject /// Object type. ///
onlyPooled bool /// If true, it will only return an object if there is one currently pooled. ///
Результат GameObject

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

public GetPoolEntryForPrefab ( GameObject prefab ) : ObjectPoolEntry
prefab GameObject
Результат ObjectPoolEntry

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

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

The container object that we will keep unused pooled objects so we dont clog up the editor with objects.
public Transform DefaultContainer
Результат Transform

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

The object prefabs which the pool can handle by The amount of objects of each type to buffer. Consider using a dictionary if there are many.
public ObjectPoolEntry[] Entries
Результат ObjectPoolEntry[]