InteractableEditor
Custom Unity Inspector editor for Interactable. Enforces read-only display for prefab instances and provides a button to open the prefab asset for modification.
Definition
Namespace: Paragon.Townskeep.InteractionSystem.Editor
Assembly: Townskeep.Editor.dll
[CustomEditor(typeof(Interactable))]
public class InteractableEditor : OdinEditorInheritance: OdinEditor → InteractableEditor
Remarks
InteractableEditor exists to prevent accidental modification of Interactable properties on prefab instances in scenes. The Interaction System's data (triggers, conditions, interactions) is authored on the prefab asset, not on instances, because InteractionTable uses Odin polymorphic serialization which does not support prefab overrides cleanly.
Behavior
Prefab asset (editing prefab directly)
Normal Odin Inspector — fully editable
Prefab instance (in scene)
Read-only + "Open Prefab Asset for Modification" button
Non-prefab instance
Normal Odin Inspector — fully editable
The prefab detection uses Tree.PrefabModificationHandler.HasPrefabs from Odin's API. When a prefab instance is detected, the entire Inspector is wrapped in DrawGUI.ReadonlyIf(true), and a toolbar button is rendered that opens the source prefab asset via AssetDatabase.OpenAsset().
Quick Lookup
Edit interactable properties
Open the prefab asset (not the scene instance)
Override on scene instance
Not supported — button redirects to prefab
Methods
OnInspectorGUI (override)
Draws the default Odin Inspector, wrapping it in read-only mode for prefab instances. Appends an "Open Prefab Asset" button when on a prefab instance.
Behavior:
Checks
Tree.PrefabModificationHandler.HasPrefabsIf prefab instance: draws all properties as read-only, then renders the "Open Prefab Asset for Modification" toolbar button
If not a prefab instance: draws properties normally (default Odin rendering)
Common Pitfalls
Cannot modify interactable on prefab instances This editor intentionally prevents editing on prefab instances. If you need to change interaction data, open the prefab asset directly or click the provided "Open Prefab Asset for Modification" button.
Extends OdinEditor, not ParagonBehaviourEditor
Unlike CharacterEditor, this editor extends OdinEditor directly rather than ParagonBehaviourEditor. This is because Interactable is sealed and does not use the subsystem/component pattern.
See Also
Interactable — the component this editor targets
InteractionTableDrawer — draws the interaction table within this editor
InteractionContextDrawer — draws individual context entries
Last updated