Class StaticInstance<T>
- Namespace
- ProjectL
- Assembly
- Assembly-CSharp.dll
A base class for creating static instances of MonoBehaviour-derived classes. Ensures that only one instance of the class exists at a time.
public class StaticInstance<T> : MonoBehaviour where T : MonoBehaviour
Type Parameters
T
The type of the MonoBehaviour-derived class.
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourStaticInstance<T>
- Derived
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.gameObjectComponent.tagComponent.rigidbodyComponent.rigidbody2DComponent.cameraComponent.lightComponent.animationComponent.constantForceComponent.rendererComponent.audioComponent.networkViewComponent.colliderComponent.collider2DComponent.hingeJointComponent.particleSystemObject.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Properties
Instance
Gets the static instance of the class.
public static T Instance { get; }
Property Value
- T
Methods
Awake()
Called when the script instance is being loaded. Ensures that the instance is assigned to the current object.
protected virtual void Awake()
OnDestroy()
Called when the MonoBehaviour will be destroyed. Resets the static instance if it matches the current object.
protected virtual void OnDestroy()