protected override void OnDisable() { if (ActiveBTEditor == this) { ActiveBTEditor = null; } base.OnDisable(); GraphCanvas.OnMouseClick = null; GraphCanvas.OnDragBegin = null; GraphCanvas.OnDrag = null; GraphCanvas.OnDragEnd = null; if (mAssetBinder != null) { mAssetBinder.updateTreeAsset -= ReloadGraph; mAssetBinder.Dispose(); mAssetBinder = null; } }
protected override void OnEnable() { ActiveBTEditor = this; base.OnEnable(); GraphCanvas.OnMouseClick = InteractCraphClick; GraphCanvas.OnDragBegin = InteractGraphDragBegin; GraphCanvas.OnDrag = InteractGraphDrag; GraphCanvas.OnDragEnd = InteractGraphDragEnd; GraphCanvas.OnKeyDown = InteractGraphKeyDown; if (mAssetBinder == null) { mAssetBinder = new BehaviourTreeAssetBinder(); } mAssetBinder.updateTreeAsset += ReloadGraph; if (mAssetBinder.targetTree == null) { mAssetBinder.SetSelectedAsset(); } else { ReloadGraph(); } }