AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
HoloToolkit.Unity.Singleton< T > Class Template Reference

Singleton behaviour class, used for components that should only have one instance. More...

Inheritance diagram for HoloToolkit.Unity.Singleton< T >:
HoloToolkit.Unity.StartAwareSingleton< T >

Static Public Member Functions

static void AssertIsInitialized ()
 
static bool ConfirmInitialized ()
 Awake and OnEnable safe way to check if a Singleton is initialized. More...
 

Protected Member Functions

virtual void Awake ()
 Base Awake method that sets the Singleton's unique instance. Called by Unity when initializing a MonoBehaviour. Scripts that extend Singleton should be sure to call base.Awake() to ensure the static Instance reference is properly created. More...
 
virtual void OnDestroy ()
 Base OnDestroy method that destroys the Singleton's unique instance. Called by Unity when destroying a MonoBehaviour. Scripts that extend Singleton should be sure to call base.OnDestroy() to ensure the underlying static Instance reference is properly cleaned up. More...
 

Properties

static T Instance [get]
 Returns the Singleton instance of the classes type. If no instance is found, then we search for an instance in the scene. If more than one instance is found, we throw an error and no instance is returned. More...
 
static bool IsInitialized [get]
 Returns whether the instance has been initialized or not. More...
 

Detailed Description

Singleton behaviour class, used for components that should only have one instance.

Singleton classes live on through scene transitions and will mark their parent root GameObject with Object.DontDestroyOnLoad

Template Parameters
TThe Singleton Type
Type Constraints
T :Singleton<T> 

Definition at line 14 of file Singleton.cs.

Member Function Documentation

§ AssertIsInitialized()

static void HoloToolkit.Unity.Singleton< T >.AssertIsInitialized ( )
static

Definition at line 49 of file Singleton.cs.

§ Awake()

§ ConfirmInitialized()

static bool HoloToolkit.Unity.Singleton< T >.ConfirmInitialized ( )
static

Awake and OnEnable safe way to check if a Singleton is initialized.

Returns
The value of the Singleton's IsInitialized property

Definition at line 69 of file Singleton.cs.

§ OnDestroy()

Property Documentation

§ Instance

T HoloToolkit.Unity.Singleton< T >.Instance
staticget

Returns the Singleton instance of the classes type. If no instance is found, then we search for an instance in the scene. If more than one instance is found, we throw an error and no instance is returned.

Definition at line 26 of file Singleton.cs.

§ IsInitialized

bool HoloToolkit.Unity.Singleton< T >.IsInitialized
staticget

Returns whether the instance has been initialized or not.

Definition at line 58 of file Singleton.cs.


The documentation for this class was generated from the following file: