Skip to main content

Object Pool

Overview

A simple implementation of object pooling.

Constructors

public ObjectPool(GameObject prefab)
public ObjectPool(GameObject prefab, string name)
public ObjectPool(GameObject prefab, string name, int prepopulated)
public ObjectPool(GameObject prefab, string name, int prepopulated, bool useParent = true)

Public Methods

public virtual GameObject GetObject(bool isRequestingNew)
public virtual void ReturnObject(GameObject gameObject)
public virtual void ReturnObjects(IList<GameObject> gameObjects)

Example