using System; using UnityEngine; using UnityEngine.AI; public class UI3DModel : MonoBehaviour { public Transform tf_model; protected void Set_3DModel(string prefab, Action act = null) { for (int i = 0; i < tf_model.childCount; i++) Destroy(tf_model.GetChild(i).gameObject); AddrResourceMgr.Ins.LoadObject(prefab, handle => { var go = DSUtil.Get_Clone(handle.Result, tf_model); if (DSUtil.CheckNull(go.GetComponent())) go.AddComponent(); DSUtil.ChangeLayersRecursively(go.transform, "UI"); //Destroy(go.GetComponent()); go.GetComponent().Stop(true); Destroy(go.GetComponent()); Destroy(go.GetComponent()); Destroy(go.GetComponent()); act?.Invoke(go.transform); }); } }