1234567891011121314151617181920212223242526272829303132333435363738 |
- 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)
- {
- Instantiate(prefab);
- }
- 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(objDic.TryGetValue("LoadingPanel(Clone)",out GameObject LoadingPanel))
- {
- if (LoadingPanel.activeSelf)
- LoadingPanel.SetActive(false);
- }
- }
- else
- Instantiate(prefab);
- }
- }
|