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 = false, Inherited = true)]
[DontApplyToListElements]
[Conditional("UNITY_EDITOR")]
public class PropertySpaceAttribute : Attribute, _Attribute
The PropertySpace attribute have the same function as Unity's existing Space attribute, but can be applied anywhere as opposed to just fields.
The following example demonstrates the usage of the PropertySpace attribute.
[PropertySpace] // Defaults to a space of 8 pixels just like Unity's Space attribute.
public int MyField;
[ShowInInspector, PropertySpace(16)]
public int MyProperty { get; set; }
[ShowInInspector, PropertySpace(16, 16)]
public int MyProperty { get; set; }
[Button, PropertySpace(32)]
public void MyMethod()
{
...
}
[PropertySpace(-8)] // A negative space can also be remove existing space between properties.
public int MovedUp;
public PropertySpaceAttribute()
public PropertySpaceAttribute(float spaceBefore)
System.Single | spaceBefore |
public PropertySpaceAttribute(float spaceBefore, float spaceAfter)
System.Single | spaceBefore | |
System.Single | spaceAfter |
public float SpaceAfter
public float SpaceBefore