Hello,
Let’s assume we have this:
GUI.changed = false;
block1();
if (GUI.changed)
block2();
and:
EditorGUI.BeginChangeCheck();
block1();
if (EditorGUI.EndChangeCheck())
block2();
Are their any differences between the two? why would I want to use either? is one more preferable to the other?
Thanks!
What BeginChangeCheck does exactly is to push current value of GUI.changed to a stack, then set GUI.changed to false. EndChangeCheck returns GUI.changed AND and set GUI.changed to its current value OR-ed with the previously stacked value. This way you can nest Begin/End change check calls and still detect the changes between pairs of those calls.
– Aberdyne