private void OnDestroy() { if (ResultHandle != null) { if (tempNPCDataInfo.NPCObj != null) { TalkShowPosition talkShowPosition = tempNPCDataInfo.NPCObj.GetComponent <TalkShowPosition>(); if (talkShowPosition != null) { GameObject.DestroyImmediate(talkShowPosition); } } if (nowIDList.Contains(tempNPCDataInfo.NPCID) || string.IsNullOrEmpty(tempNPCDataInfo.npcPrefabName) || !isCreate) { if (tempNPCDataInfo != null && tempNPCDataInfo.NPCObj) { GameObject.DestroyImmediate(tempNPCDataInfo.NPCObj); } tempNPCDataInfo = null; } //如果对象是商人,则将心有的数据序列化进去 if (tempNPCDataInfo != null && tempNPCDataInfo.NPCType == EnumNPCType.Businessman) { tempNPCDataInfo.OtherValue = BusinessmanDataInfo.SerializeNow(businessmanDataInfo); } ResultHandle(tempNPCDataInfo); } }
private void Awake() { targetObj = target as TalkShowPosition; }