Skip to content

IPoolable.OnPoolUnSpawn

Andrés Eduardo Maldonado edited this page Jun 14, 2019 · 3 revisions

Method from IPoolable (interface)

Method signature

public void OnPoolUnSpawn()

Description

Called before the object needs to go back to the pool.

Usage

public class ExampleScript : MonoBehaviour, IPoolable
{
    private int counter;

    public void OnPoolSpawn()
    {
        counter++;
        Debug.Log("I've been spawned " + counter + "times!");
    }

    public void OnPoolUnSpawn()
    {
        // Other events here.
    }
}