void DoWatchesWindow() { watchesScroll = GUILayout.BeginScrollView(watchesScroll); foreach (var watch in watches.ToArray()) { GUILayout.BeginHorizontal(); var type = GetWatchType(watch); GUI.contentColor = config.typeColor; GUILayout.Label(type.ToString()); GUI.contentColor = config.nameColor; GUILayout.Label(watch.ToString()); GUI.contentColor = Color.white; GUILayout.Label(" = "); GUI.enabled = false; var value = watch.Evaluate(); GUI.contentColor = config.valueColor; if (value == null || !TypeUtil.IsSpecialType(type)) { GUILayout.Label(value == null ? "null" : value.ToString()); } else { try { GUIControls.EditorValueField(watch, "watch." + watch, type, value); } catch (Exception) { GUILayout.Label(value == null ? "null" : value.ToString()); } } GUI.contentColor = Color.white; GUI.enabled = true; GUILayout.FlexibleSpace(); if (GUILayout.Button("Find in Scene Explorer")) { var sceneExplorer = FindObjectOfType <SceneExplorer>(); sceneExplorer.ExpandFromRefChain(watch.Trim(watch.Length - 1)); sceneExplorer.visible = true; } if (GUILayout.Button("Find in Resources Explorer")) { var sceneExplorer = FindObjectOfType <ResourcesExplorer>(); sceneExplorer.ExpandFromRefChain(watch.Trim(watch.Length - 1)); sceneExplorer.visible = true; } if (GUILayout.Button("x", GUILayout.Width(24))) { RemoveWatch(watch); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); }
void DoWatchesWindow() { watchesScroll = GUILayout.BeginScrollView(watchesScroll); foreach (var watch in GetWatches()) { GUILayout.BeginHorizontal(); var type = GetWatchType(watch); GUI.contentColor = config.typeColor; GUILayout.Label(type.ToString()); GUI.contentColor = config.nameColor; GUILayout.Label(watch.ToString()); GUI.contentColor = Color.white; GUILayout.Label(" = "); if (IsConstWatch(watch)) { GUI.enabled = false; } var value = ReadWatch(watch); GUI.contentColor = config.valueColor; if (value == null || !TypeUtil.IsBuiltInType(type)) { GUILayout.Label(value == null ? "null" : value.ToString()); } else { try { var newValue = GUIControls.EditorValueField(watch, "watch." + watch, type, value); if (newValue != value) { WriteWatch(watch, newValue); } } catch (Exception) { GUILayout.Label(value == null ? "null" : value.ToString()); } } GUI.contentColor = Color.white; GUI.enabled = true; GUILayout.FlexibleSpace(); if (GUILayout.Button("x", GUILayout.Width(24))) { RemoveWatch(watch); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); }