Version 2.1.0.0

Odin has a dedicated attribute overview with examples

SuffixLabelAttribute class

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector.Attributes
[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 = false)]
public sealed class SuffixLabelAttribute : Attribute, _Attribute

The SuffixLabel attribute draws a label at the end of a property.

Use this for conveying intend about a property. Is the distance measured in meters, kilometers, or in light years?. Is the angle measured in degrees or radians? Using SuffixLabel, you can place a neat label at the end of a property, to clearly show how the the property is used.

Inheritance
  • System.Object
  • System.Attribute
  • SuffixLabelAttribute
Example

The following examples demonstrates how SuffixLabel is used.

public class MyComponent : MonoBehaviour
{
	// The SuffixLabel attribute draws a label at the end of a property.
	// It's useful for conveying intend about a property.
	// Fx, this field is supposed to have a prefab assigned.
	[SuffixLabel("Prefab")]
	public GameObject GameObject;

	// Using the Overlay property, the suffix label will be drawn on top of the property instead of behind it.
	// Use this for a neat inline look.
	[SuffixLabel("ms", Overlay = true)]
	public float Speed;

	[SuffixLabel("radians", Overlay = true)]
	public float Angle;

	// The SuffixLabel attribute also supports string member references by using $.
	[SuffixLabel("$Suffix", Overlay = true)]
	public string Suffix = "Dynamic suffix label";
}

Constructors

SuffixLabelAttribute(String, Boolean)
Draws a label at the end of the property.
public SuffixLabelAttribute(string label, bool overlay = false)
Parameters
System.String label

The text of the label.

System.Boolean overlay

If true the suffix label will be drawn on top of the property, instead of after.

Fields

Label
The label displayed at the end of the property.
public string Label
Overlay
If true the suffix label will be drawn on top of the property, instead of after.
public bool Overlay