void OnGUI() { // On play, Logger is reloaded, but LogTree is not. As a result // repaint may skip; defensively reassign here. Logger.treeView = instance; instance = this; UpdateCurrent(); if (current) { scroll = EditorGUILayout.BeginScrollView(scroll); Title(current.name); if (!Application.isPlaying) { Label("Log-Tree will appear while playing"); } else if (!current.activeInHierarchy) { Label("(currently inactive)"); } else { int count = ActiveStepperCount(current); if (count == 0) { Label("Enable logging to start"); } else { foreach (var k in current.GetComponents <Stepper>()) { if (k.isLogging && !string.IsNullOrEmpty(k.log)) { if (count > 1) { Title(k.GetType().Name); } Label(k.log); } } } } EditorGUILayout.EndScrollView(); } else { Label("Select an active agent/stepper to view"); } }
static void Init() { instance = (LogTree)EditorWindow.GetWindow(typeof(LogTree)); instance.Show(); Logger.treeView = instance; }