Unity中的Inspector面板可以显示的属性包括以下两类:(1)C#以及Unity提供的基础类型;(2)自定义类型,并使用[System.Serializable]关键字序列化,比如:[System.Serializable]public class TestClass{ public Vector3 vec = Vector3.zero; public Color System 自定
[CreateAssetMenu]publicclassTestSO : ScriptableObject {publicList<Test>testList; } 显示如下 修改数据类显示 数据元素内容显示为一行 注意:不能使用自动布局api usingUnityEngine;usingUnityEditor; [CustomPropertyDrawer(typeof(Test))]publicclassTestDrawer : PropertyDrawer {publicoverridevoidOnGUI(Rect position, ...
using UnityEngine; using UnityEditor; using Unity.VisualScripting.Dependencies.Sqlite; [CustomPropertyDrawer(typeof(LabelAttribute))] public class LabelAttributeDrawer : PropertyDrawer { public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { LabelAttribute attr = attribute ...
三、Code 1usingUnityEngine;2usingSystem.Collections;3usingUnityEditor;45namespaceRunAndJump.LeveCreator6{7//[CanEditMultipleObjects]//希望多个挂在该类的对象可以在inspector面板选定多个一同修改的话8//需要将该标签添加上,由于level类一个场景下只有一个,所以无需添加该标记9[CustomEditor(typeof(Level))]10...
OdinInspector; 2.AssetsOnly\SceneObjectsOnly:引用限制为预制体\场景物体 限制拖拽赋值的物体来源 代码语言:javascript 代码运行次数:0 运行 AI代码解释 [Title("Assets only")] [AssetsOnly] public List<GameObject> OnlyPrefabs; [Title("Scene Objects only")] [SceneObjectsOnly] public List<GameObject> Only...
material = new Material(Shader.Find("Custom/CubeMiaoBian")); characters = new List<GameObject>(); charactersMesh = new List<MeshRenderer>(); initialcolor = cubes.GetChild(1).GetComponent<MeshRenderer>().material.color; for (int i = 0; i < cubes.childCount; i++) ...
[CustomContextMenu("SetAgeTen", "SetValueAsTen")]publicintAge;publicvoidSetValueAsTen(){Age=10;} 2.DisableContextMenu 禁用右键菜单 [DisableContextMenu]publicintDisableAge; 右键点击属性就不会有菜单了 3.DrawWithUnity 用Unity默认的显示方法显示Inspector上的属性,Odin导入Unity后Odin会改变属性的显示方式,...
把Property暴露到面板上:http://wiki.unity3d.com/index.php?title=Expose_properties_in_inspector 详细的Editor例子:http://catlikecoding.com/unity/tutorials/editor/custom-list/ http://catlikecoding.com/unity/tutorials/editor/custom-data/ Editor高阶例子:http://catlikecoding.com/unity/tutorials/editor...
Inspector Bind to nested properties Bind to a UXML template Receive callbacks when a bound property changes Receive callbacks when any bound properties change Bind to a list with ListView Bind to a list without ListView Bind a custom control Bind a custom control to custom data type View data ...
public List<GameObject> stars; [HideInInspector] public bool mapCreated; [HideInInspector] public GameObject mapRoot; [HideInInspector] public GameObject starRoot; //某些星星被删除掉了。视图里也要删除 public void StarDelete() { } public void Save() ...