Version 3.0.4.0

Odin has a dedicated attribute overview with examples

LabelTextAttribute 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 = false, Inherited = true)]
[Conditional("UNITY_EDITOR")]
public class LabelTextAttribute : Attribute, _Attribute

LabelText is used to change the labels of properties.

Use this if you want a different label than the name of the property.

Inheritance
  • System.Object
  • System.Attribute
  • LabelTextAttribute
Example

The following example shows how LabelText is applied to a few property fields.

public MyComponent : MonoBehaviour
{
	[LabelText("1")]
	public int MyInt1;

	[LabelText("2")]
	public int MyInt2;

	[LabelText("3")]
	public int MyInt3;
}
See Also

Constructors

LabelTextAttribute(String)
Give a property a custom label.
public LabelTextAttribute(string text)
Parameters
System.String text

The new text of the label.

LabelTextAttribute(String, Boolean)
Give a property a custom label.
public LabelTextAttribute(string text, bool nicifyText)
Parameters
System.String text

The new text of the label.

System.Boolean nicifyText

Whether to nicify the label text.

Fields

NicifyText
Whether the label text should be nicified before it is displayed, IE, "m_someField" becomes "Some Field". If the label text is resolved via a member reference, an expression, or the like, then the evaluated result of that member reference or expression will be nicified.
public bool NicifyText
Text
The new text of the label.
public string Text