检查代码块中是否有任何控件被更改。
When needing to check if GUI.changed is set to true inside a block of code, wrap the code inside a ChangeCheckScope like this:
using UnityEditor;
class ExampleClass { void ExampleMethod() { using (var check = new EditorGUI.ChangeCheckScope()) { // Block of code with controls // that may set GUI.changed to true
if (check.changed) { // Code to execute if GUI.changed // was set to true inside the block of code above. } } } }
changed | 如果 GUI.changed 已设置为 true,则为 true;否则为 false。 |
EditorGUI.ChangeCheckScope | 开始一个 ChangeCheckScope。 |