private static void CalculateDepth() { var panel = UnityEditor.Selection.activeTransform.GetComponent <UIPanel>(); var widgets = GetPanelWidgets(panel, false); UnityEditor.Undo.RecordObjects(widgets, "CalculateDepth"); DepthCalculationAlgorithm.CalculateDepthForWidgets(widgets); }
private static void AdjustDepth() { var panel = UnityEditor.Selection.activeTransform.GetComponent <UIPanel>(); var widgets = GetPanelWidgets(panel, false); DepthCalculatorBindingAlgorithm.BindToWidgets(widgets); UnityEditor.Undo.RecordObjects(widgets, "AdjustDepth"); DepthCalculationAlgorithm.CalculateDepthForWidgets(widgets); foreach (var w in widgets) { var c = w.GetComponent <DepthCalculator>(); if (c != null) { NGUITools.Destroy(c); } } }