Table of Contents

Class DontCreateNewSingleton<T>

Utility class to make inheriting types singletons.

public class DontCreateNewSingleton<T> : MonoBehaviour where T : Component

Type Parameters

T

The type to be made a singleton.

Inheritance
System.Object
DontCreateNewSingleton<T>

Remarks

Unlike Singleton<T>, this does not create a new instance of T if there are no existing ones.

Properties

HasInstance

Is there an existing instance of type T?

public static bool HasInstance { get; }

Property Value

bool

Instance

The active instance of type T.

public static T Instance { get; protected set; }

Property Value

T

Methods

Awake()

protected virtual void Awake()