CharacterEditor
Custom Unity Inspector editor for the Character behaviour. Extends ParagonBehaviourEditor to display character info (name, possessor) and configure the subsystem drawer with custom icons, names, priorities, and removability rules for each character component type.
Definition
Namespace: Paragon.Townskeep.CharacterSystem.Editor
Assembly: Townskeep.Editor.dll
[CustomEditor(typeof(Character))]
public class CharacterEditor : ParagonBehaviourEditorInheritance: OdinEditor → ParagonEditor → ParagonEditor<ParagonBehaviour> → ParagonBehaviourEditor → CharacterEditor
Remarks
CharacterEditor customizes how Character instances appear in the Inspector. It does two key things:
Header info — Displays the character's name and possessor status in the existing header layout
Subsystem drawer configuration — Configures the
ParagonSubsystemDrawerwith per-component metadata:Icons — Visual icons for each component type (e.g., camera icon for
CharacterCamera)Names — Friendly display names (e.g., "Motor" instead of "CharacterMotor")
Priority — Display ordering in the subsystem list
Removability — Whether a component can be removed by the user (core components like Motor and Camera cannot be removed unless debug mode is enabled)
Component Metadata Registry
The editor maintains a static dictionary mapping component types to their display metadata:
CharacterMotor
Motor
0
CHIP
No
CharacterCamera
Camera
1
CAMERA
No
CharacterAnimator
Animator
2
ANIMATOR
No
CharacterController
Controller
3
GAMEPAD
No
CharacterInteractor
Interactor
4
FINGER
Yes
CharacterInventory
Inventory
5
UI_CANVAS_GROUP
Yes
CharacterNetwork
Network
6
SATELLITE
No
Components not in the metadata registry default to: icon = LAYERS, priority = int.MaxValue (sorted last), name = nicified type name with "Character" prefix removed.
When Character.DebugEnabled is true, all components can be removed regardless of the canBeRemoved flag in the metadata.
Quick Lookup
Add a new component to the registry
Add entry to componentMetaData dictionary
Change component display order
Modify the priority value (lower = higher in list)
Make a component non-removable
Set canBeRemoved: false in metadata
Allow removal in debug mode
Already handled — GetCanBeRemoved checks character.DebugEnabled
Methods
OnCreateGUI (override)
Sets up the Inspector UI. Populates the header with character name/possessor info and configures the subsystem drawer with icon, priority, name, and removability getters.
Always call base.OnCreateGUI() — it resolves the subsystemProperty required for the subsystem drawer.
OnInspectorGUI (override)
Empty override — all rendering is handled by the UIElements-based OnCreateGUI and the subsystem drawer.
GetName (static)
Returns the display name for a component type. Falls back to nicifying the type name with "Character" removed.
GetPriority (static)
Returns the sort priority for a component type. Falls back to int.MaxValue.
GetIconType (static)
Returns the ParagonIconType for a component type. Falls back to LAYERS.
GetCanBeRemoved
Returns whether a component type can be removed. Returns true if debug mode is enabled or if the type's metadata allows removal.
Extension Points
To add a new character component to the Inspector:
Add the component type to the
componentMetaDatadictionary with name, priority, icon, and removabilityThe subsystem drawer will automatically pick up the new entry
Common Pitfalls
Missing metadata entry
If a new CharacterComponent subclass is added without a corresponding entry in componentMetaData, it will still appear in the Inspector but with default icon (LAYERS), max priority (sorted last), and auto-generated name.
OnInspectorGUI is empty
This editor uses UIElements via OnCreateGUI(). The OnInspectorGUI() override is intentionally empty to prevent IMGUI drawing. Do not add IMGUI code here.
See Also
ParagonBehaviourEditor — base class providing subsystem management
ParagonSubsystemDrawer — the drawer that renders the component list
Last updated