using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Snxxz.UI { public class HUDCenter { public static HUDRoot hudRoot { get; set; } public static HUDRoot CreateHUDRoot() { if (hudRoot == null) { var prefab = Resources.Load("UI/Prefabs/HUDRoot"); var instance = GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity); instance.name = "HUDRoot"; hudRoot = instance.GetComponent(); GameObject.DontDestroyOnLoad(instance); } return hudRoot; } } }