Odin Inspector 系列教程 --- Table Column Width Attribute

TableColumnWidth屬性用于進一步自定義使用“ TableListAttribute” 繪制的表中的列的寬度。

【Resizable】 控制是否自動調整大小
using Sirenix.OdinInspector;
using Sirenix.Utilities.Editor;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TableColumnWidthAttributeExample : MonoBehaviour
{
    [TableList]
    public List<MyItem> List = new List<MyItem>()
{
    new MyItem(),
    new MyItem(),
    new MyItem(),
};

    [Serializable]
    public class MyItem
    {
        [PreviewField(Height = 20)]
        [TableColumnWidth(30, Resizable = false)]
        public Texture2D Icon;

        [TableColumnWidth(60)]
        public int ID;
        [TableColumnWidth(100)]
        public string Name;
    }
}

更多教程內容詳見:革命性Unity 編輯器擴展工具 --- Odin Inspector 系列教程

?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容