override public void OnInspectorGUI() { brain = target as Brain; Initialize(); if (GUILayout.Button("Edit Brain")) { BrainWindow.ShowWindow(brain); } DrawParameters(); if ((BrainWindow.window != null)) { if (BrainWindow.window.selectedNode != null) { DrawNodeInspector(BrainWindow.window.selectedNode); } if (BrainWindow.window.selectedConnection != null) { DrawConnectionInspector(BrainWindow.window.selectedConnection); } } if (GUILayout.Button("Clear")) { brain.Clear(); RefreshAsset(); } }
public static void ShowWindow(Brain brain) { window = EditorWindow.GetWindow(typeof(BrainWindow)) as BrainWindow; window.title = "Brain"; window.scrollPosition = Vector2.zero; window.brain = brain; window.CenterOnNodes(); }
void OnGUI() { window = this; if(brain == null) brain = Selection.activeObject as Brain; if(brain == null) { GUILayout.Label("Select a brain."); return; } GUILayout.Label(scrollPosition.ToString()); DrawBrain(); WindowEvents(); }