class in UnityEditor.UI / 继承自:UI.SelectableEditor 描述 Button 组件的自定义编辑器。 扩展该类,为 Button 派生的组件编写自定义编辑器。 另请参阅:Editor、CustomEditor。 公共函数 OnInspectorGUI请参阅 Editor.OnInspectorGUI。 继承的成员 变量
一、创建编辑器窗口(EditorWindow) 1、创建继承自 EditorWindow 的类 MyWindow。(脚本必须放在“Editor”文件夹下) 2、在 MyWindow 的 OnGUI 函数中编写 GUI 控件。可使用 GUI、GUILayout、EditorGUI、EditorGUILayout类,并且可以随意混合搭配使用。 3、通过调用 EditorWindow.GetWindow(typeof(MyWindow)) 展示。
这是一个编辑器类,如果想使用它你需要把它放到工程目录下的Assets/Editor文件夹下。编辑器类在UnityEditor命名空间下。所以当使用C#脚本时,你需要在脚本前面加上 “using UnityEditor”引用。 接下来开始制作的我们自己的 Inpector,对于自定义 Inpector 面板可参考EditorGUILayout的API: BeginFadeGroup 开始一个可以...
using UnityEditor;[CustomEditor(typeof(DialogueSO))]publicclassDialogueSOEditor:Editor{ private DialogueSO _selectSO; privatebool_showDictionary =true; privatestring_statusStr ="节点字典"; privatevoidOnEnable(){ _selectSO = target as DialogueSO; } public overridevoidOnInspectorGUI(){ base.OnInspect...
using UnityEngine.Profiling;/* ... Omitted...*/privateCustomSampler _samplerTest=CustomSampler.Create("Test");privatevoidTestMethod(){for(int i=0;i<10000;i++){Debug.Log("Test");}}privatevoidOnClickedButton(){_samplerTest.Begin();TestMethod();_samplerTest.End();} ...
EditorGUILayout.HelpBox("攻击力太低了", MessageType.Warning); } //按钮绘制 GUILayout.Button("来个按钮"); GUILayout.Button("来个按钮"); //开始横向排序 EditorGUILayout.BeginHorizontal(); GUILayout.Button("来个按钮"); GUILayout.Button("来个按钮"); ...
scaleToggle; EditorUtility.SetDirty(Target); } GUI.color = animation.fadeToggle ? color : Color.gray; if (GUILayout.Button(EditorGUIUtility.IconContent("ViewToolOrbit"), "ButtonRight", GUILayout.Width(25f))) { Undo.RecordObject(Target, "On Show Animation Fade Toggle"); animation.fadeToggle =...
Assets/Create – items will be listed when clicking on the “Create” button in the project view (useful when adding new types that can be added to the project) CONTEXT/ComponentName – items will be available by right-clicking inside the inspector of the given component. Here are some examp...
button. void OnWizardCreate() { } } 代码1-3 使用Editor Windows类进行扩展 完全自定义窗口,根据需求定义窗口内容和布局。使用时继承EditorWindow类,重写“OnGUI”函数。例子如代码1-4 using UnityEngine; using UnityEditor; public class MyWindow : EditorWindow { string myString = "Hello ...
12、DropdownButton:下拉框 DropdownButton可能大家不了解,也许会用不到,它的效果跟EnumPopup,不过EnumPopup是基于枚举类,序列化出来的,而DropdownButton是根据自定义添加子项。 13、EditorGUILayout.ObjectField 序列化Object物体 EditorGUILayout.ObjectField组件是用于显示一些针对继承UnityEngine.Object类的相关组件,比如Gam...