OutlineEditor
Custom Inspector for the Outline component. Renders color and width properties inside a styled DrawGUI.Box with a header label, and live-applies changes to the outline material via Outline.ApplySettings() when values are modified.
Definition
Namespace: Paragon.Townskeep.OutlineSystem.Editor
Assembly: Townskeep.Editor.dll
[CustomEditor(typeof(Outline))]
public class OutlineEditor : OdinEditorInherits: OdinEditor (Odin Inspector)
Remarks
This editor replaces Unity's default Inspector for the Outline component with a clean, styled layout using Paragon's DrawGUI utility. It draws only the color and width serialized fields, wrapped in a box with an "Outline Settings" header.
The key feature is live preview: an EditorGUI.BeginChangeCheck() / EndChangeCheck() block detects when the user modifies either property, then immediately calls outline.ApplySettings() to push the new values to the shader material. This means color and width changes are visible in the Scene view without needing to enter play mode.
After applying settings, Tree.ApplyChanges() is called to persist the Odin property tree changes to the serialized object.
Quick Lookup
Live preview outline changes
Changes are applied automatically via ApplySettings()
Access the Outline target
(Outline)target
Draw properties via Odin tree
Tree.RootProperty.Children["fieldName"].Draw()
Methods
OnInspectorGUI
Renders the custom Inspector layout:
Inspector Layout
The editor renders:
color
Color picker with [ColorPalette("Outlines")]
Outline color selection from the "Outlines" palette
width
Slider [Range(0, 10)]
Outline width in pixels
Common Pitfalls
Changes applied during edit mode
ApplySettings() modifies the outline fill material's shader properties even in edit mode. Since the fill material is created per-instance in Awake(), this only works if the component has been initialized (i.e., has entered play mode at least once, or the material is otherwise set up).
Only draws two fields
The editor explicitly draws only color and width from the property tree. Other serialized fields on Outline (if any are added) will not appear unless the editor is updated.
See Also
Outline — the component being edited
SmoothNormals — smooth normal baking used by the Outline component
Last updated