using System.Collections; using System.Collections.Generic; using System.Threading; using System.Timers; using UnityEngine; namespace GeneralTools { public class SingletonBaseAttribute : BaseAttribute where T : BaseAttribute { private static T instance; public static T Instance { get { if (instance == null) { instance = FindObjectOfType(); if (instance == null) { instance = new GameObject().AddComponent(); } instance.IAwake(); instance.IStart(); } return instance; } } public override void IAwake() { base.IAwake(); instance = this as T; } } }