public override void OnBeforeSerialize(BTAsset btAsset) { base.OnBeforeSerialize(btAsset); if (string.IsNullOrEmpty(m_behaviourTreeID)) { m_behaviourTreeID = BTUtils.GenerateUniqueStringID(); } btAsset.SetSubtreeAsset(m_behaviourTreeID, m_behaviourTreeAsset); }
public virtual BehaviourTree GetEditModeTree() { string nm = this.name; if (m_editModeTree == null) { m_editModeTree = BTUtils.DeserializeTree(m_serializedData); if (m_editModeTree != null) { if (string.IsNullOrEmpty(m_editModeTree.guidString) || lastFileName != this.name) { m_editModeTree.guidString = BTUtils.GenerateUniqueStringID(); } m_editModeTree.Root.OnAfterDeserialize(this); m_editModeTree.ReadOnly = false; } } return(m_editModeTree); }