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); }
public void SelectConnection(ConnectionUI connection) { if (SelectedConnection != null) { SelectedConnection.IsConnectionSelected = false; } SelectedConnection = connection; if (SelectedConnection != null) { SelectedConnection.IsConnectionSelected = true; if (SelectedConnection is TransitionConnectionUI transitionConnection) { TransitionInspector.Show(transitionConnection); } else { TransitionInspector.Hide(); } } else { TransitionInspector.Hide(); } }