检查代码块中是否有任何控件被更改。
当需要检查 GUI.changed 是否在代码块中设置为 true 时, 请按如下方式将代码封装在 ChangeCheckScope 中:
class ExampleClass
{
void ExampleMethod()
{
using (var check = new 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。 |