using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; namespace SC.XR.Unity { public abstract class RemoteSingleton : MonoBehaviour where T : MonoBehaviour { public GameObject[] Prefab; [HideInInspector] public List window=new List(); private static T instance; private static object lockObj = new object(); public static T Instance { get { return instance; } } public virtual void Awake() { instance = (T)FindObjectOfType(typeof(T)); ScenesManager.Instance.initWindow(this.gameObject); } public virtual void initShow() { if(Prefab!=null&& window.Count<=0) { for (int i = 0; i < Prefab.Length; i++) { window.Add(GameObject.Instantiate(Prefab[i], this.transform)); window[window.Count - 1].name = Prefab[i].name; } } } } }