diff --git a/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs b/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs index d0ec0c68d9..78f939d355 100644 --- a/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs +++ b/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs @@ -133,8 +133,8 @@ public class CECNPC : CECObject BMLogger.LogError("HoangDev npcVisual"); } m_pNPCModelPolicy.SetNpcVisual(npcVisual); - m_npcUI = GetComponentInChildren(); - + m_npcUI = GetComponentInChildren(true); + m_npcUI.gameObject.SetActive(true); // 2) Cắt “đuôi” ngay sau phần cố định info_npc int fixedSize = System.Runtime.InteropServices.Marshal.SizeOf(); @@ -1170,7 +1170,10 @@ public class CECNPC : CECObject // UINPC.Start can run before async model instantiate; refresh anchor once SMR hierarchy exists. // UINPC.Start可能在异步模型实例化之前执行;SMR层次就绪后刷新名牌锚点。 - m_npcUI?.RefreshWorldNameplatePosition(); + if(m_npcUI != null && m_npcUI.gameObject.activeInHierarchy) + { + m_npcUI?.RefreshWorldNameplatePosition(); + } //QueueECModelForLoad(MTL_ECM_NPC, GetNPCInfo().nid, GetBornStamp(), GetServerPos(), szModelFile, tid); }