public void ReInitializeDebugItemStates() { CleanUp(); // Populate item states DebugMenuManager dmm = DebugMenuManager.instance; for (int panelIdx = 0; panelIdx < dmm.panelCount; ++panelIdx) { DebugPanel panel = dmm.GetDebugPanel(panelIdx); for (int itemIdx = 0; itemIdx < panel.itemCount; ++itemIdx) { DebugItem item = panel.GetDebugItem(itemIdx); DebugItemState debugItemState = FindDebugItemState(item); if (debugItemState == null) { debugItemState = item.handler.CreateDebugItemState(); if (debugItemState != null) { debugItemState.hideFlags = HideFlags.DontSave; debugItemState.Initialize(item); debugItemState.SetValue(item.GetValue()); AddDebugItemState(debugItemState); } else { Debug.LogWarning(String.Format("DebugItemState for item {0} of type {1} is not provided.\nDid you implement CreateDebugItemState in your custom Handler?", item.name, item.type)); } } } } UpdateAllDebugItems(); }
public void OnEnable() { #if UNITY_EDITOR UnityEditor.Undo.undoRedoPerformed += OnUndoRedoPerformed; #endif // Populate item states DebugMenuManager dmm = DebugMenuManager.instance; for (int panelIdx = 0; panelIdx < dmm.panelCount; ++panelIdx) { DebugPanel panel = dmm.GetDebugPanel(panelIdx); for (int itemIdx = 0; itemIdx < panel.itemCount; ++itemIdx) { DebugItem item = panel.GetDebugItem(itemIdx); DebugItemState debugItemState = FindDebugItemState(item); if (debugItemState == null) { debugItemState = item.handler.CreateDebugItemState(); debugItemState.hideFlags = HideFlags.DontSave; debugItemState.Initialize(item); debugItemState.SetValue(item.GetValue()); AddDebugItemState(debugItemState); } } } DebugMenuManager.instance.SetDebugMenuState(this); }
void DebugItem_OnDirty(DebugItem item) { DebugItemState debugItemState = m_DebugMenuState.FindDebugItemState(item); UnityEditor.Undo.RecordObject(debugItemState, "DebugMenu State Update"); debugItemState.SetValue(item.GetValue()); EditorUtility.SetDirty(m_DebugMenuState); }