Click or drag to resize

SingletonT Class

Manages the single instance of a class.

Note: Do NOT use this singleton with UnityEngine.MonoBehaviour. Take care with how Unity manages lifetime of objects.

See SingletonBehaviour for a Unity-friendly singleton.

Inheritance Hierarchy
SystemObject
  ImmerseSDKSingletonT

Namespace:  ImmerseSDK
Assembly:  ImmerseSDK.App (in ImmerseSDK.App.dll) Version: 3.5.0.0 (3.5.0.0)
Syntax
C#
public sealed class Singleton<T>
where T : class

Type Parameters

T
Type of the singleton class.

The SingletonT type exposes the following members.

Constructors
  NameDescription
Private methodStatic memberSingletonT
Public methodSingletonT
Initializes a new instance of the SingletonT class
Top
Properties
  NameDescription
Public propertyStatic memberInstance
Gets the single instance of the class.
Top
Remarks
Generic variant of the strategy presented here. Preferred to this singleton, where static initialization doesn't allow proper handling of exceptions, and doesn't allow retrying type initializers initialization later (once a type initializer fails to initialize in .NET, it can't be re-initialized again).
See Also