BITKit/Src/Unity/Scripts/Utility/Behaviour.cs

21 lines
445 B
C#
Raw Normal View History

2024-04-06 16:33:32 +08:00
using System;
2023-06-05 19:57:17 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
2023-06-29 14:57:11 +08:00
2023-06-05 19:57:17 +08:00
using UnityEngine.UIElements;
2023-06-29 14:57:11 +08:00
#if UNITY_EDITOR
using UnityEditor;
#endif
2023-06-05 19:57:17 +08:00
namespace BITKit
{
2024-04-06 16:33:32 +08:00
public abstract class MonoBehaviourSingleton<T> : MonoBehaviour
{
public static T Singleton { get; private set; }
2024-06-11 17:16:34 +08:00
protected virtual void Awake()
2024-04-06 16:33:32 +08:00
{
if (this is T t) Singleton = t;
}
2023-06-29 14:57:11 +08:00
}
2023-06-05 19:57:17 +08:00
}