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)]
[Conditional("UNITY_EDITOR")]
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.
The following example 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";
}
public SuffixLabelAttribute(SdfIconType icon)
SdfIconType | icon | The icon to be displayed. |
public SuffixLabelAttribute(string label, SdfIconType icon, bool overlay = false)
System.String | label | The text of the label. |
SdfIconType | icon | The icon to be displayed. |
System.Boolean | overlay | If |
public SuffixLabelAttribute(string label, bool overlay = false)
System.String | label | The text of the label. |
System.Boolean | overlay | If |
public string IconColor
public string Label
true
the suffix label will be drawn on top of the property, instead of after.
public bool Overlay
public bool HasDefinedIcon { get; }
public SdfIconType Icon { get; set; }