public void UndoableConditionalToggle(Rect r, ref bool value, bool usableIf, bool disabledDisplayValue, string label, string undoSuffix) { bool nextValue = value; SF_GUI.ConditionalToggle(r, ref nextValue, usableIf, disabledDisplayValue, label); if (nextValue != value) { string undoName = (nextValue ? "enable" : "disable") + " " + undoSuffix; Undo.RecordObject(this, undoName); value = nextValue; } }