Persistent Lazy Singleton
Last updated
Last updated
namespace:
Inherits: MonoBehaviour
Base class for persistent, lazy-loaded, scene-contained Singletons. If the scene does not already contain an instance, it will create one. T.Instance
will not be destroyed between scenes.
public static T Instance
: The instance of T
in the scene. It will never be null. If there is not an instance in the scene, a new instance will be made/returned.
protected virtual void Awake()
: enforces Singleton pattern.
protected virtual void OnDestroy()
: sets T.Instance
to null.