Class CachedBehaviour<T>
Scene-contextual alternative to SingletonBehaviour<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 SourceExists
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. |
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. |