Skip to content

Commit

Permalink
Fix Build Settings changes not being saved immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
sttz committed Oct 21, 2019
1 parent 4da0eac commit 6defb55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions Editor/ProfileEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -601,14 +601,13 @@ protected void ResurseOptionsGUI(bool showBuild = false)
optionAvailable = true;
buildCategory = showBuild;

Option.changed = false;

foreach (var option in options) {
OptionGUIRecursive(option);
}

if (Option.changed) {
FlushProfile();
Option.changed = false;
}
}

Expand Down
8 changes: 5 additions & 3 deletions Options/OptionBuildSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ public override bool EditGUI()
Array.Sort(optionNames, optionFlags);
}

EditorGUI.BeginChangeCheck();

string name = "Multiple...";

// Unity defines some deprecated flags as 0 as well (e.g.
Expand All @@ -146,6 +144,7 @@ public override bool EditGUI()
var menu = new GenericMenu();
menu.AddItem(new GUIContent("Clear Options"), false, () => {
Value = 0;
Option.changed = true;
});
menu.AddSeparator("");
for (int i = 0; i < optionFlags.Length && i < optionNames.Length; i++) {
Expand All @@ -154,12 +153,15 @@ public override bool EditGUI()
var selected = (Value & flag) == flag;
menu.AddItem(new GUIContent(optionNames[i]), selected, () => {
Value ^= flag;
Option.changed = true;
});
}
menu.ShowAsContext();
}

return EditorGUI.EndChangeCheck();
// The value is changed in the GenericMenu callbacks,
// which set Option.changed to true manually instead of returning true here.
return false;
}
}

Expand Down

0 comments on commit 6defb55

Please sign in to comment.