private void OnEnable()
        {
            Editor       = this;
            titleContent = new GUIContent("State Machine");

            string resourcesPath = $"{AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this)).Replace($"/{nameof(StateMachineEditor)}.cs", "")}/Resources";

            _styleSheet = AssetDatabase.LoadAssetAtPath <StyleSheet>($"{resourcesPath}/{_ussPath}");

            _toolbar = new Toolbar();

            _saveButton = new ToolbarButton(SaveStateMachine)
            {
                text = "Save"
            };

            _toolbar.Add(_saveButton);

            TransitionInspector = new TransitionInspector();
            TransitionInspector.SetValueWithoutNotify(false);
            TransitionInspector.Hide();

            rootVisualElement.Add(_toolbar);
            rootVisualElement.Add(TransitionInspector);

            rootVisualElement.styleSheets.Add(_styleSheet);

            this.SetAntiAliasing(4);
        }
        private void OnDestroy()
        {
            Editor    = null;
            IsClosing = true;

            rootVisualElement.Remove(GraphView);
            rootVisualElement.Remove(_toolbar);
            _styleSheet = null;

            IsClosing = false;
        }
        public StateMachineNodeUI() : base()
        {
            StateMachineNodeAsset = new StateMachineNodeAsset {
                Data = new StateMachineNode()
            };

            Button openEditorButton = new Button(() =>
            {
                StateMachineEditor.OpenEditor();
                StateMachineEditor.Editor.LoadStateMachine(this);
            })
            {
                text = "Edit"
            };

            mainContainer.Insert(1, openEditorButton);

            GenerateOutputPort(_portColor);
        }