Class SingletonBehaviour<T>
Singleton<T> adapted to extend UnityEngine.MonoBehaviour.
Inheritance
Object
Component
Behaviour
MonoBehaviour
SingletonBehaviour<T>
Namespace: GGL.Singleton
Assembly: GGL.dll
Syntax
[HelpURL("https://ggl.yoannhaffner.com/articles/singleton.html")]
public abstract class SingletonBehaviour<T> : SingletonBehaviour where T : SingletonBehaviour<T>
Type Parameters
Name | Description |
---|---|
T | Monobehaviour class |
Remarks
When you can, try to setup static class to avoid using methods of a dead class.
Examples
Properties
| Edit this page View SourceInitialized
Declaration
public static bool Initialized { 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. |
Instance
Declaration
public static T Instance { get; }
Property Value
Type | Description |
---|---|
T | Access the cached instance. If it does not exist, it will be created on a new root GameObject. |