Odin Inspector 系列教程 --- Enum Paging Attribute

Enum Paging Attribute特性:用于在检查器中使用下一个和上一个按钮绘制枚举选择器,以便循环访问枚举属性的可用值

【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;
    }
}

更多教程内容详见:革命性Unity 编辑器扩展工具 --- Odin Inspector 系列教程

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容