static void ToggleUseElementBounds() { s_AlwaysUseObjectBounds.SetValue(!s_AlwaysUseObjectBounds.value, true); if (s_Instance != null) { s_Instance.RebuildBounds(); EditorUtility.ShowNotification("Dimensions Overlay\n" + (s_AlwaysUseObjectBounds.value ? "Object" : "Element")); } }
static void ToggleUseElementBounds() { // toggle between { Off, Visible Object, Visible Selection } if (s_Instance != null) { var display = s_BoundsDisplay.value; // Visible Object -> Visible Selection if (display == BoundsDisplay.Object) { s_BoundsDisplay.SetValue(BoundsDisplay.Element, true); } // Visible Selection -> Off else { DestroyImmediate(s_Instance); } } else { // Off -> Visible Object s_BoundsDisplay.SetValue(BoundsDisplay.Object, true); Init(); } if (s_Instance != null) { s_Instance.RebuildBounds(); EditorUtility.ShowNotification("Dimensions Overlay\n" + s_BoundsDisplay.value.ToString()); } else { EditorUtility.ShowNotification("Dimensions Overlay\nOff"); } SceneView.RepaintAll(); }