MainManager.cs 871 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace InfraredDLLManager
  5. {
  6. /// <summary>
  7. /// 生成ui入口
  8. /// </summary>
  9. public class MainManager : MonoBehaviour
  10. {
  11. #region 生成红外交互对象
  12. public GameObject spawnObj;
  13. #endregion
  14. // Start is called before the first frame update
  15. void Awake()
  16. {
  17. UIManager uIManager = UIManager.GetInstance();
  18. // 确保对象被正确创建
  19. if (uIManager != null)
  20. {
  21. uIManager.showManager(); // 执行管理功能
  22. }
  23. else {
  24. //初始化
  25. var infraredManager = GameObject.Instantiate(spawnObj);
  26. DontDestroyOnLoad(infraredManager);
  27. infraredManager.name = "InfraredView";
  28. }
  29. }
  30. }
  31. }