EditorGUI.BeginChangeCheck public static void BeginChangeCheck(); Description Check if any control was changed inside a block of code.When needing to check if GUI.changed is set to true inside a block of code, wrap the code inside BeginChangeCheck () and EndChangeCheck () like this:...
1、当UI信息改动时执行某个命令 EditorGUI.BeginChangeCheck(); width = EditorGUILayout.IntField("width : ", width); if (EditorGUI.EndChangeCheck()) { Debug.Log("===width changed==="); } 2、在EditorWindow上显示图片,或图片的Alpha通道 EditorGUI.DrawPreviewTexture(new Rect(offset.x, offse...
当p0对应坐标轴被我们拖动改变后,EditorGUI.EndChangeCheck()方法会返回true,此时就可以将其坐标进行转换,修改脚本中p0的值。 ? 1 2 3 4 5 6 7 8 9 10 EditorGUI.BeginChangeCheck(); p0 = Handles.DoPositionHandle(p0, handleRotation); if(EditorGUI.EndChangeCheck()) { line.p0 = handleTransform.I...
;showPosition=false;}}voidOnInspectorUpdate(){Repaint();}}3.2 检查 GUI 更改: BeginChangeCheck 、EndChangeCheck 监听值改变●BeginChangeCheck:...注意:与使用 EditorGUI.BeginDisabledGroup()/EditorGUI.EndDisabledGroup() 相比,DisabledScope 通常更可取,因为它提供了一个更加安全的作用域机制3.4...
6.2 变更检查 -EditorGUI.BeginChangeCheck 对在BeginChangeCheck和EndChangeCheck范围内的GUI进行任何更改时,EndChangeCheck将返回true。 usingUnityEditor;usingUnityEngine;publicclassEditorTest : EditorWindow {privatebooltoggleValue; [MenuItem("Tools/Example")]staticvoidOpen() ...
GUILayout.BeginHorizontal( ); // 对中间的元素进行横排布局 GUILayout.EndHorizontal( ); 折叠: // 声明bool变量 private bool fold; // 在代码之间包裹折叠内容 fold =EditorGUILayout.BeginFoldoutHeaderGroup(fold, "Foldout"); if (fold) {
EditorGUI.BeginChangeCheck(); point = Handles.DoPositionHandle(point, handleRotation); if(EditorGUI.EndChangeCheck()) { Undo.RecordObject(spline,"Move Point"); EditorUtility.SetDirty(spline); spline.points[index] = handleTransform.InverseTransformPoint(point); ...
EditorGUI.BeginChangeCheck(); using (var scope = new EditorGUILayout.VerticalScope(GUILayout.Width(500))) { //temp = EditorGUILayout.TextField("What: ", temp); EditorGUILayout.PropertyField(serPty, true); } using (var scope = new EditorGUILayout.VerticalScope(GUILayout.Width(500))) ...
{ EditorGUI.BeginChangeCheck(); var newValue = EditorGUI.IntField(new Rect(position.x, position.y, position.width, position.height / 2),label,property.intValue); EditorGUI.LabelField(new Rect(position.x, position.y + position.height /2 , position.width, position.height / 2), "Item ...
BeginChangeCheck(); //预计完成日期 GUILayout.Label("预计完成日期:", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); //年 if (GUILayout.Button("<", GUILayout.Width(18f))) currentTodo.estimatedCompletedTime = currentTodo.estimatedCompletedTime.AddYears(-1); GUILayout.Label(currentTodo....