EditorUtility.SetDirty public static void SetDirty (Object target); 参数 target 标记为“脏”的对象。 描述 将target 对象标记为“脏”(仅适用于非场景对象)。 注意:对于 Unity 5.3 之前的版本,这是将对象标记为“脏”的主要方法。从 Unity 5.3 版本开始,我们引入了多场景编辑功能,此函数不再用于修改场...
EditorUtility.SetDirty :这个函数告诉引擎,相关对象所属于的Prefab已经发生了更改。方便,当我们更改了自定义对象的属性的时候,自动更新到所属的Prefab中。 EditorUtility.IsPersistent:这个函数用于判定是否对象是被保存到硬盘中的。 EditorUtility.DisplayDialog:显示一个对话框,类似于MessageBox,有Yes、No按钮 EditorUtility...
SetCustomDiffTool Set custom diff tool settings. SetDefaultParentObject Sets the default parent object for the active Scene. SetDialogOptOutDecision This method displays a modal dialog that lets the user opt-out of being shown the current dialog box again. SetDirty Marks target object as dirty....
//先在循环内用setDirty将修改后的预制体进行标记EditorUtility.SetDirty(go);//然后在循环结束的时候调用保存所有被标记的资源与刷新AssetDatabase.SaveAssets();AssetDatabase.Refresh(); 4.编辑器下到底应该如何卸载资源? 使用第一种方式(AssetDatabase.LoadAssetAtPath)加载了对应的预制体后,发现这个东西居然不能用...
public static void SetValue(this SerializedProperty property, object value) { Undo.RecordObject(property.serializedObject.targetObject, $"Set {}"); SetValueNoRecord(property, value); EditorUtility.SetDirty(property.serializedObject.targetObject);
EditorUtility.SetDirty(target); } 修改后完整代码如下: using UnityEngine; using System.Collections; using UnityEditor; //指定要编辑的脚本为 Car.CS [CustomEditor(typeof(Car))] [CanEditMultipleObjects] // 5.1.2版本只有要在多个对象上挂Car.CS要加该句 ...
将target强制转换为对应组件类型对象,然后直接修改对象身上的值。 优点: 简单好理解,用起来比较方便 缺点: 不能修改私有序列化对象 不能自动处理多选、Undo等操作状态 注意: 直接修改对象后,要使用EditorUtility.SetDirty(target) 将target标记为脏状态,否则修改状态不会被记录 ...
DotHandleCapDraw a camera-facing dot. Pass this into handle functions. RectangleHandleCap画个矩形 2DGUI类 用GUILayout或EditorGUILayout代替吧。示例有原因 BeginGUIBegin a 2D GUI block inside the 3D handle GUI. EndGUIEnda 2D GUI block and get back to the 3D handle GUI. ...
GUILayout.Label("U Can Select GameObjects By Mouse In Hierachy And Project Then Open This Window");//选择目标字体GUILayout.Space(10); GUILayout.Label("Target Font"); targetFont = (Font)EditorGUILayout.ObjectField(targetFont,typeof(Font),true); ...
stateName = stateNames[newIndex]; EditorUtility.SetDirty(Target); } GUILayout.EndHorizontal(); } } else { EditorGUILayout.HelpBox("no animator component on this view.", MessageType.Error); } break; default: break; } break; case Menu.UnityEvent: //OnBeginEvent、OnEndEvent EditorGUILayout....