Title Group Attribute特性:用于提供一個(gè)標(biāo)題Group唇敞,將對應(yīng)的成員劃分
【TitleGroup】提供一個(gè)主標(biāo)題框冀,或者可額外提供一個(gè)副標(biāo)題
[TitleGroup("Ints")]
public int SomeInt1;
[TitleGroup("Ints", "Optional subtitle")]
public int SomeInt2;
【Alignment】可選擇對應(yīng)標(biāo)題的對齊方式
[TitleGroup("TitleAlignments_Left", "可選副標(biāo)題", alignment: TitleAlignments.Left)]
public string titleLeft = "";
[TitleGroup("TitleAlignments_Centered", "可選副標(biāo)題", alignment: TitleAlignments.Centered)]
public string titleCentered = "";
[TitleGroup("TitleAlignments_Right", "可選副標(biāo)題", alignment: TitleAlignments.Right)]
public string titleRight = "";
[TitleGroup("TitleAlignments_Split", "可選副標(biāo)題", alignment: TitleAlignments.Split)]
public string titleSplit = "";
可是使用$特殊指定一個(gè)字段的值作為標(biāo)題
public string DynamicTitle = "DynamicTitle";
[TitleGroup("$DynamicTitle", "Optional subtitle")]
public string SomeString1;
【可設(shè)置是否縮進(jìn)】
[TitleGroup("Vectors", "Optional subtitle", alignment: TitleAlignments.Centered, horizontalLine: true, boldTitle: true, indent: true)]
public Vector2 SomeVector0;
[TitleGroup("Vectors_Indent", "Optional subtitle", alignment: TitleAlignments.Centered, horizontalLine: true, boldTitle: true, indent: false)]
public Vector2 SomeVector1;
可以隱藏標(biāo)題下面的橫線
[TitleGroup("NoTitle", horizontalLine:false)]
public string noTitleStr = "noTitleStrContent";
完整示例代碼
using Sirenix.OdinInspector;
using UnityEngine;
public class TitleGroupAttributeExample : MonoBehaviour
{
[TitleGroup("Ints")]
public int SomeInt1;
[TitleGroup("Ints", "Optional subtitle")]
public int SomeInt2;
[TitleGroup("TitleAlignments_Left", "可選副標(biāo)題", alignment: TitleAlignments.Left)]
public string titleLeft = "";
[TitleGroup("TitleAlignments_Centered", "可選副標(biāo)題", alignment: TitleAlignments.Centered)]
public string titleCentered = "";
[TitleGroup("TitleAlignments_Right", "可選副標(biāo)題", alignment: TitleAlignments.Right)]
public string titleRight = "";
[TitleGroup("TitleAlignments_Split", "可選副標(biāo)題", alignment: TitleAlignments.Split)]
public string titleSplit = "";
[PropertySpace(40)]
public string DynamicTitle = "DynamicTitle";
[TitleGroup("$DynamicTitle", "Optional subtitle")]
public string SomeString1;
[TitleGroup("Vectors", "Optional subtitle", alignment: TitleAlignments.Centered, horizontalLine: true, boldTitle: true, indent: true)]
public Vector2 SomeVector0;
[TitleGroup("Vectors_Indent", "Optional subtitle", alignment: TitleAlignments.Centered, horizontalLine: true, boldTitle: true, indent: false)]
public Vector2 SomeVector1;
[TitleGroup("NoTitle", horizontalLine:false)]
public string noTitleStr = "noTitleStrContent";
}