menu_bookDocumentation
Property Attributes: Inspector Customization for Components and Assets
Property attributes control how Component properties appear in the s&box editor/inspector. They work on both Components and GameResource properties.
Layout and Visibility
| Attribute | Effect |
|---|---|
| [Hide] | Hidden from editor but still saves/loads |
| [ReadOnly] | Visible but not editable |
| [Advanced] | Hidden unless user opts to see advanced properties |
| [Space] | Adds space above the property |
| [Header( "My Header" )] | Adds a header above |
| [Order( 100 )] | Controls display order |
| [Title( "Custom Name" )] | Overrides the property name in editor |
| [InlineEditor] | Shows inline editing instead of popup |
| [WideMode] | Full-width widget with label above |
| [KeyProperty] | Represents the whole object in a single line |
Grouping
| Attribute | Effect |
|---|---|
| [Group( "Helpers" )] | Creates a group box |
| [ToggleGroup( "UseHelpers" )] | Group with on/off checkbox (name matches a bool property) |
| [Feature( "Helpers" )] | Separate tab in inspector |
| [FeatureEnabled( "Helpers" )] | Bool that enables/disables a feature tab |
Conditional Display
CSHARP
[ShowIf( "PropertyName", 3 )] // Show only when PropertyName == 3
[HideIf( "PropertyName", 3 )] // Hide when PropertyName == 3Numeric Properties
CSHARP
[Range( 0, 100 )] // Min/max with slider (clamped by default)
[Step( 10 )] // Increment step when draggingString Properties
| Attribute | Effect |
|---|---|
| [Placeholder( "hint text" )] | Shown when empty |
| [TextArea] | Multiline text area |
| [FilePath] | File picker (optional extension filter) |
| [ImageAssetPath] | Image file selector |
| [MapAssetPath] | .vmap file selector |
| [FontName] | Font dropdown |
| [InputAction] | Input action dropdown from Project Settings |
Validation
CSHARP
[Validate( nameof( IsValid ), "Warning Message", LogLevel.Warn )]Calls a method for validation and shows the result in the inspector.
Other
| Attribute | Effect |
|---|---|
| [RequireComponent] | Auto-creates the component if missing |
| [Flags] | Enum treated as flags (multi-select dropdown) |
| [ResourceType( "vmdl" )] | Filters resource picker by type |
Was this helpful?