Search Results for

    Show / Hide Table of Contents

    Class ObjectPooler

    Simulates object instantiation and destruction by recycling them.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    SingletonBehaviour
    SingletonBehaviour<ObjectPooler>
    ObjectPooler
    Inherited Members
    SingletonBehaviour<ObjectPooler>.Instance
    SingletonBehaviour<ObjectPooler>.Initialized
    Namespace: GGL.Pooling
    Assembly: GGL.dll
    Syntax
    [AddComponentMenu("GG-Library/Singletons/Object Pooler")]
    [HelpURL("https://ggl.yoannhaffner.com/articles/gameobject.html#optimisation")]
    public class ObjectPooler : SingletonBehaviour<ObjectPooler>

    Methods

    | Edit this page View Source

    Clear()

    Clear the cache of registered objects.

    Declaration
    public static void Clear()
    | Edit this page View Source

    Create(string, params Type[])

    Simulates a gameobject creation by recycling if available (real new otherwise).

    Declaration
    public static GameObject Create(string name, params Type[] components)
    Parameters
    Type Name Description
    string name Simulates object instantiation and destruction by recycling them.
    Type[] components Simulates object instantiation and destruction by recycling them.
    Returns
    Type Description
    GameObject
    Remarks

    DO NOT RENAME THE INSTANCIATED OBJECT PLEASE.

    | Edit this page View Source

    Destroy(GameObject)

    Simulate the destruction of a gameobject by recycling him

    Declaration
    public static void Destroy(GameObject poolObject)
    Parameters
    Type Name Description
    GameObject poolObject
    | Edit this page View Source

    Destroy<T>(T)

    Simulate the destruction of an object by recycling him.

    Declaration
    public static void Destroy<T>(T poolObject) where T : Component
    Parameters
    Type Name Description
    T poolObject
    Type Parameters
    Name Description
    T Simulates object instantiation and destruction by recycling them.
    | Edit this page View Source

    Instantiate(GameObject, Transform)

    Simulates an object instantiation by recycling if available (real instantiate otherwise).

    Declaration
    public static GameObject Instantiate(GameObject prefab, Transform parent = null)
    Parameters
    Type Name Description
    GameObject prefab
    Transform parent
    Returns
    Type Description
    GameObject
    Remarks

    DO NOT RENAME THE INSTANCIATED OBJECT PLEASE.

    | Edit this page View Source

    Instantiate<T>(T, Transform)

    Simulates an object instantiation by recycling if available (real instantiate otherwise).

    Declaration
    public static T Instantiate<T>(T prefab, Transform parent = null) where T : Component
    Parameters
    Type Name Description
    T prefab
    Transform parent
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T Simulates object instantiation and destruction by recycling them.
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX