using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// 单例 /// /// public class Singleton : MonoBehaviour where T : MonoBehaviour { public static T Instance { get { if (_Instance == null) { _Instance = FindObjectOfType(); } return _Instance; } } static T _Instance; }