C# Class ObjectPool, SimpleObjectPool

Inheritance: MonoBehaviour
ファイルを表示 Open project: gazialankus/SimpleObjectPool Class Usage Examples

Public Properties

Property Type Description
DefaultContainer Transform
Entries ObjectPoolEntry[]

Public Methods

Method Description
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

Method Details

Awake() public method

public Awake ( ) : void
return void

GetObjectForPrefab() public method

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. ///
return GameObject

GetPoolEntryForPrefab() public method

public GetPoolEntryForPrefab ( GameObject prefab ) : ObjectPoolEntry
prefab GameObject
return ObjectPoolEntry

Property Details

DefaultContainer public_oe property

The container object that we will keep unused pooled objects so we dont clog up the editor with objects.
public Transform DefaultContainer
return Transform

Entries public_oe property

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
return ObjectPoolEntry[]