API reference

SingletonMonoBehaviour Class

Extends MonoBehaviour
A base class for creating singleton MonoBehaviours that can be instantiated in code or as part of the scene.


If unspecified, SingletonMonoBehaviours are destroyed when a scene change occurs.
Use the SingletonMonoBehaviour.InstantiationSettings attribute to change the DontDestroyOnLoad behaviour.
Consider setting [DefaultExecutionOrder(-1)] on the derived class.

Properties

Instance : T
[Get]
The reference to the singleton instance.
Signature
T Instance

Inner Class

InstantiationSettings Class

Extends Attribute
Defines settings for the instantiation of singleton MonoBehaviours.

Fields

dontDestroyOnLoad : bool
Signature
bool dontDestroyOnLoad