Version 3.3.1.2

Odin has a dedicated attribute overview with examples

TitleAttribute class

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.

Inheritance
  • System.Object
  • System.Attribute
  • TitleAttribute
Example
The following example shows how Title is used on different properties.
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; } }
}

Constructors

TitleAttribute(String, String, TitleAlignments, Boolean, Boolean)
Creates a title above any property in the inspector.
public TitleAttribute(string title, string subtitle = null, TitleAlignments titleAlignment = TitleAlignments.Left, bool horizontalLine = true, bool bold = true)
Parameters
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 drawn with a bold font.

Fields

Bold
If true the title will be displayed with a bold font.
public bool Bold
HorizontalLine
Gets a value indicating whether or not to draw a horizontal line below the title.
public bool HorizontalLine
Subtitle
Optional subtitle.
public string Subtitle
Title
The title displayed above the property in the inspector.
public string Title
TitleAlignment
Title alignment.
public TitleAlignments TitleAlignment