PropertySpaceAttribute

The PropertySpace attribute have the same function as Unity's existing Space attribute, but can be applied anywhere as opposed to just fields.

namespace Sirenix.OdinInspector
{
[AttributeUsageAttribute((AttributeTargets)32767, AllowMultiple = False, Inherited = True)]
public class PropertySpaceAttribute : Attribute
}

Requirements

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector
Version: 2.0.0.0

See Also

Fields

Return Type Definition Description
float SpaceAfter The space between properties in pixels.
float SpaceBefore The space between properties in pixels.

Constructors

Definition Description
PropertySpaceAttribute() Adds a space of 8 pixels between properties.
PropertySpaceAttribute(float) Adds a space between properties.
PropertySpaceAttribute(float, float) Adds a space between properties.

Example

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;