fix: Update UINPC when spawn.

This commit is contained in:
Tungdv
2026-05-16 16:59:51 +07:00
parent 143ae3d954
commit e947354bc4
+6 -3
View File
@@ -133,8 +133,8 @@ public class CECNPC : CECObject
BMLogger.LogError("HoangDev npcVisual");
}
m_pNPCModelPolicy.SetNpcVisual(npcVisual);
m_npcUI = GetComponentInChildren<UINPC>();
m_npcUI = GetComponentInChildren<UINPC>(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<info_npc>();
@@ -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);
}