12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- 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<T> : MonoBehaviour where T : MonoBehaviour
- {
- public GameObject[] Prefab;
- [HideInInspector]
- public List<GameObject> window=new List<GameObject>();
- 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;
- }
- }
- }
- }
- }
|