What problem does it solve?
This Skill guides developers in extending the editor's script inspector to support custom data types. It details how to implement the IFieldEditor interface for runtime polymorphic rendering of script properties discovered via reflection, handling boxing/unboxing patterns, and registering new editors with the FieldEditorRegistry.
Core Features & Use Cases
- IFieldEditor Implementation: Create custom field editors for new types (e.g.,
Quaternion, Color, custom structs).
- Reflection-Based Editing: Understand how the script inspector uses
IFieldEditor to render arbitrary types at runtime.
- Boxing/Unboxing Patterns: Correctly handle
object boxing and unboxing for value types.
- FieldEditorRegistry: Register custom field editors to make them discoverable by the script inspector.
- Use Case: If game scripts use a custom
Color struct, this Skill enables you to create a ColorFieldEditor that renders an intuitive color picker in the script inspector, allowing designers to easily adjust script-defined colors.
Quick Start
Show me how to create a new IFieldEditor for a custom Color struct, including its Draw method and registration in FieldEditorRegistry.