Version: 5.6

EditorGUI.BeginChangeCheck

切换到手册
public static void BeginChangeCheck ();

描述

检查代码块中是否有任何控件被更改。

当需要检查 GUI.changed 是否在代码块中设置为 true 时, 请按如下方式将代码封装在 BeginChangeCheck () 和 EndChangeCheck () 中:

EditorGUI.BeginChangeCheck ();

// Block of code with controls // that may set GUI.changed to true.

if (EditorGUI.EndChangeCheck ()) { // Code to execute if GUI.changed // was set to true inside the block of code above. }

只有当 GUI.changed 在代码块中设置为 true 时, EndChangeCheck 才会返回 true;但如果 GUI.changed 在内部设置为 true 或者 在开始时已设置为 true,那么它将为 true。