123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System.Collections.Generic;
- using Blue;
- using UnityEngine;
- using TMPro;
- public class InstantiateSystem : SingletonMonobehaviour<InstantiateSystem>
- {
- [SerializeField] private BlueObject blueObject;
- public BlueObject BlueObject => blueObject;
- public Dictionary<string, GameObject> objDic = new Dictionary<string, GameObject>();
- public void InstantiatePrefab(GameObject prefab,GameObject parent =null)
- {
- Instantiate(prefab,parent.transform);
- }
- public void InstantiatePrefab(GameObject prefab, string content = "")
- {
- if (content != "")
- {
- // 修改显示内容,并实例化到CenterCamera
- prefab.GetComponentInChildren<TextMeshProUGUI>().text = content;
- /*
- GameObject CenterCamera = GameObject.Find("SDKSystem/NRCameraRig/CenterCamera");
- if(CenterCamera!=null)
- Instantiate(prefab, CenterCamera.transform);
- */
- if (OpenXRCamera.Instance.head != null)
- Instantiate(prefab, OpenXRCamera.Instance.head);
- // 关闭加载界面
- if (objDic.TryGetValue("LoadingPanel(Clone)",out GameObject LoadingPanel))
- {
- if (LoadingPanel.activeSelf)
- LoadingPanel.SetActive(false);
- }
- }
- else
- Instantiate(prefab);
- }
- }
|