Search Results for

    Show / Hide Table of Contents

    Class CachedBehaviour<T>

    Scene-contextual alternative to SingletonBehaviour<T>.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    CachedBehaviour<T>
    Namespace: GGL.Singleton
    Assembly: GGL.dll
    Syntax
    [HelpURL("https://ggl.yoannhaffner.com/articles/singleton.html")]
    public class CachedBehaviour<T> : MonoBehaviour where T : CachedBehaviour<T>
    Type Parameters
    Name Description
    T

    Monobehaviour class

    Remarks

    It won't be automatically instantiated: add your script in scene.

    Properties

    | Edit this page View Source

    Exists

    Declaration
    public static bool Exists { get; }
    Property Value
    Type Description
    bool

    Check if the Singleton has been initialized. Happens if it has not yet been accessed nor awaken in any scene.

    | Edit this page View Source

    Instance

    Declaration
    public static T Instance { get; }
    Property Value
    Type Description
    T

    Access the cached instance. If it does not exist, will try to find it in scene and cache it.

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX