Odin Attributes 为Unity开发者提供了更多的自定义选项,使得开发过程更加高效和愉悦。通过使用这些特性,开发者可以创建更加专业和用户友好的编辑器界面,从而提升整个开发团队的工作效率。
Enum Paging 特性用于在 Inspector 中使用下一个和上一个按钮绘制枚举选择器,以便循环访问枚举属性的可用值。
【EnumPaging】比较简单,直接使用就好
using Sirenix.OdinInspector;
using UnityEngine;
public class EnumPagingAttributeExample : MonoBehaviour
{
[EnumPaging]
public SomeEnum SomeEnumField;
public enum SomeEnum
{
A, B, C
}
[ShowInInspector]
[EnumPaging, OnValueChanged("SetCurrentTool")]
[InfoBox("Changing this property will change the current selected tool in the Unity editor.")]
private UnityEditor.Tool sceneTool;
private void SetCurrentTool()
{
UnityEditor.Tools.current = this.sceneTool;
}
}