ParagonBehaviour
Abstract base class for all Paragon MonoBehaviours. Extends Odin's SerializedMonoBehaviour with an optional ParagonSubsystem slot for component-based composition and automatic registration with the Paragon debug system.
Definition
Namespace: Paragon
Assembly: Paragon.dll
[Serializable]
public abstract class ParagonBehaviour : Sirenix.OdinInspector.SerializedMonoBehaviour, IParagonBehaviourInherits: Sirenix.OdinInspector.SerializedMonoBehaviour → MonoBehaviour
Implements: IParagonBehaviour, IDebugObject
Remarks
ParagonBehaviour is the standard base class for any MonoBehaviour in the Paragon framework. It provides three features on top of Unity's MonoBehaviour:
Odin serialization — inheriting from
SerializedMonoBehaviourenables polymorphic serialization, dictionary fields, interfaces in Inspector, and other Odin features.Subsystem slot — an optional
ParagonSubsystemreference for attaching components via the composition pattern. Checked viaHasSubsystem.Debug registration — automatically registers with
Debug.Register()onOnEnable()and unregisters onOnDisable(), enabling per-frameOnDebug()callbacks whenDebugEnabledis true.
Quick Lookup
Create a Paragon MonoBehaviour
Subclass ParagonBehaviour
Check for subsystem
behaviour.HasSubsystem
Access the subsystem
Cast to IParagonBehaviour and access .Subsystem
Enable debug rendering
behaviour.DebugEnabled = true, override OnDebug()
Properties
DebugEnabled
Controls whether OnDebug() is called by the debug system each frame.
Serialized but hidden in Inspector ([HideInInspector]).
HasSubsystem
Whether this behaviour has a ParagonSubsystem assigned.
Subsystem
The attached ParagonSubsystem. Accessed via the IParagonBehaviour interface (explicit implementation).
Methods
OnEnable
Registers with the debug system. Override to add custom enable logic — always call base.OnEnable().
OnDisable
Unregisters from the debug system. Override to add custom disable logic — always call base.OnDisable().
OnDebug
Override point for per-frame debug rendering. Called by the debug system when DebugEnabled is true.
Extension Points
Optional Overrides
OnEnable()
Custom enable logic — call base.OnEnable() first
OnDisable()
Custom disable logic — call base.OnDisable() first
OnDebug()
Per-frame debug rendering (gizmos, overlay text)
Implementation Requirements
When subclassing ParagonBehaviour, you MUST:
Call
base.OnEnable()if overridingOnEnable()— this registers with the debug systemCall
base.OnDisable()if overridingOnDisable()— this unregisters from the debug system
You SHOULD:
Use
[Serializable]on the class for proper serializationAssign a
ParagonSubsystemin the Inspector if your behaviour needs componentsUse Odin serialization attributes (
[OdinSerialize],[ShowInInspector]) for advanced Inspector features
Common Pitfalls
Must call base.OnEnable / base.OnDisable
Overriding OnEnable() or OnDisable() without calling base will skip debug registration/unregistration, causing OnDebug() to stop working or leaving stale entries in the debug list.
Subsystem is explicitly implemented
The Subsystem property is an explicit interface implementation. You cannot access it directly on a ParagonBehaviour reference — cast to IParagonBehaviour first or provide a public accessor in your subclass.
Debug is conditional
Debug.Register() and Debug.Unregister() only compile when DEBUG_ENABLED is defined. In release builds, OnDebug() is never called regardless of DebugEnabled.
Examples
Basic behaviour
Behaviour with subsystem
See Also
ParagonObject — non-Unity serializable base (equivalent for plain objects)
ParagonScriptableObject — ScriptableObject base
ParagonSubsystem — component container attached to behaviours
ParagonComponent<TBehaviour> — components that attach to behaviours via subsystems
Last updated