menu_bookDocumentation

Property Attributes for Editor Inspector

calendar_today May 3, 2026 schedule ~1 min read person patrickjr verified 50

Property Attributes for Editor Inspector

Property attributes customize how fields appear and behave in the s&box editor inspector.

Organization Attributes

AttributePurpose
[Group("Name")]Creates a collapsible group box
[ToggleGroup("PropertyName")]Group with checkbox toggle (bool property holds state)
[Title("New Title")]Changes the displayed property name
[Order(100)]Controls inspector display order
[Space]Adds vertical spacing
[Header("Section")]Adds a bold header above property

Visibility Attributes

AttributePurpose
[Hide]Hides property from inspector
[ShowIf("PropertyName", value)]Shows when condition matches
[HideIf("PropertyName", value)]Hides when condition matches
[ReadOnly]Display only, cannot edit
[Advanced]Hidden behind "Advanced" dropdown

Value Constraints

AttributePurpose
[Range(0, 100)]Slider with min/max, optional clamping
[Step(10)]Snap to step increments
[Flags]Display enum as bit flags

String-Specific

AttributePurpose
[Placeholder("Hint text")]Input placeholder hint
[TextArea]Multi-line text field
[FilePath]File picker with validation
[ImageAssetPath]Image asset picker
[MapAssetPath]Map file picker
[FontName]Font selection dropdown
[InputAction]Input action name picker

Editor Widgets

AttributePurpose
[InlineEditor]Edit referenced object inline
[WideMode]Wider input field
[RequireComponent]Auto-adds required component

Validation

CSHARP
[Validate(nameof(IsValid), "Warning message", LogLevel.Warn)]
public int Value { get; set; }

bool IsValid() => Value > 0;

Example Usage

CSHARP
public class Weapon : Component
{
    [Group("Stats"), Range(0, 100)]
    public float Damage { get; set; } = 50;
    
    [Group("Stats"), Range(0.1f, 5f), Title("Fire Rate")]
    public float FireRate { get; set; } = 0.2f;
    
    [ToggleGroup("UseRecoil"), Range(0, 10)]
    public float RecoilAmount { get; set; } = 2;
    
    [ShowIf("UseRecoil", true)]
    public bool UseRecoil { get; set; } = true;
    
    [FilePath, Title("Fire Sound")]
    public string FireSound { get; set; }
}
Was this helpful?