Namespace: | Sirenix.OdinInspector |
Assembly: | Sirenix.OdinInspector.Attributes |
[DontApplyToListElements]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter | AttributeTargets.All, AllowMultiple = true, Inherited = true)]
[Conditional("UNITY_EDITOR")]
public class TitleAttribute : Attribute, _Attribute
Title is used to make a bold header above a property.
public class TitleExamples : MonoBehaviour
{
[Title("Titles and Headers")]
[InfoBox(
"The Title attribute has the same purpose as Unity's Header attribute," +
"but it also supports properties, and methods." +
"\n\nTitle also offers more features such as subtitles, options for horizontal underline, bold text and text alignment." +
"\n\nBoth attributes, with Odin, supports either static strings, or refering to members strings by adding a $ in front.")]
public string MyTitle = "My Dynamic Title";
public string MySubtitle = "My Dynamic Subtitle";
[Title("Static title")]
public int C;
public int D;
[Title("Static title", "Static subtitle")]
public int E;
public int F;
[Title("$MyTitle", "$MySubtitle")]
public int G;
public int H;
[Title("Non bold title", "$MySubtitle", bold: false)]
public int I;
public int J;
[Title("Non bold title", "With no line seperator", horizontalLine: false, bold: false)]
public int K;
public int L;
[Title("$MyTitle", "$MySubtitle", TitleAlignments.Right)]
public int M;
public int N;
[Title("$MyTitle", "$MySubtitle", TitleAlignments.Centered)]
public int O;
public int P;
[Title("$Combined", titleAlignment: TitleAlignments.Centered)]
public int Q;
public int R;
[ShowInInspector]
[Title("Title on a Property")]
public int S { get; set; }
[Title("Title on a Method")]
[Button]
public void DoNothing()
{ }
public string Combined { get { return this.MyTitle + " - " + this.MySubtitle; } }
}
public TitleAttribute(string title, string subtitle = null, TitleAlignments titleAlignment = TitleAlignments.Left, bool horizontalLine = true, bool bold = true)
System.String | title | The title displayed above the property in the inspector. |
System.String | subtitle | Optional subtitle |
TitleAlignments | titleAlignment | Title alignment |
System.Boolean | horizontalLine | Horizontal line |
System.Boolean | bold | If |
true
the title will be displayed with a bold font.
public bool Bold
public bool HorizontalLine
public string Subtitle
public string Title
public TitleAlignments TitleAlignment