using System; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.AI; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.UI; public class UI3DModel : MonoBehaviour { public RawImage RawImage_costume; public Transform tf_model; AsyncOperationHandle currentHandle; protected void Set_2DIlust(CostumeListTableData costumeData) { if (!DSUtil.CheckNull(costumeData)) { AddrResourceMgr.Ins.LoadObject($"Assets/Res_Addr/PCCostumeImage/{costumeData.s_Image}.png", handle => { if (currentHandle.IsValid()) { Addressables.Release(currentHandle); RawImage_costume.texture = null; // 기존 Texture 참조 해제 } currentHandle = handle; RawImage_costume.enabled = true; RawImage_costume.texture = handle.Result; }); } } protected void Set_3DModel(bool pc, string prefab, Action act = null) { for (int i = 0; i < tf_model.childCount; i++) Destroy(tf_model.GetChild(i).gameObject); var path = pc ? $"Assets/Res_Addr/PC/{prefab}.prefab" : prefab; AddrResourceMgr.Ins.LoadObject(path, 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); }); } }