Version 3.3.1.2

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(SdfIconType)
Give a property a custom icon.
public LabelTextAttribute(SdfIconType icon)
Parameters
SdfIconType icon

The icon to be shown next to the property.

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

The new text of the label.

LabelTextAttribute(String, SdfIconType)
Give a property a custom label with a custom icon.
public LabelTextAttribute(string text, SdfIconType icon)
Parameters
System.String text

The new text of the label.

SdfIconType icon

The icon to be displayed.

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.

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

The new text of the label.

System.Boolean nicifyText

Whether to nicify the label text.

SdfIconType icon

The icon to be displayed.

Fields

Icon
The icon to be displayed.
public SdfIconType Icon
IconColor
Supports a variety of color formats, including named colors (e.g. "red", "orange", "green", "blue"), hex codes (e.g. "#FF0000" and "#FF0000FF"), and RGBA (e.g. "RGBA(1,1,1,1)") or RGB (e.g. "RGB(1,1,1)"), including Odin attribute expressions (e.g "@this.MyColor"). Here are the available named colors: black, blue, clear, cyan, gray, green, grey, magenta, orange, purple, red, transparent, transparentBlack, transparentWhite, white, yellow, lightblue, lightcyan, lightgray, lightgreen, lightgrey, lightmagenta, lightorange, lightpurple, lightred, lightyellow, darkblue, darkcyan, darkgray, darkgreen, darkgrey, darkmagenta, darkorange, darkpurple, darkred, darkyellow.
public string IconColor
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