From e947354bc45f9235dfd072534fc98fb26419e8f9 Mon Sep 17 00:00:00 2001 From: Tungdv Date: Sat, 16 May 2026 16:59:51 +0700 Subject: [PATCH] fix: Update UINPC when spawn. --- Assets/PerfectWorld/Scripts/NPC/CECNPC.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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); }