ParagonNetworkBehaviour

Abstract base class for all Paragon network-aware MonoBehaviours. Extends Unity Netcode's NetworkBehaviour with Paragon conventions: static ClientID access, a reference to the Paragon NetworkManager, and integration with the Paragon debug system via IDebugObject.

Definition

Namespace: Paragon.Core.Network Assembly: Paragon.dll

[Serializable]
public abstract class ParagonNetworkBehaviour : NetworkBehaviour, IDebugObject

Inheritance: NetworkBehaviourParagonNetworkBehaviour Implements: IDebugObject

Remarks

This class serves the same role for networked code that ParagonBehaviour serves for non-networked code — it provides a consistent base class with debug tooling and convenient accessors. All game-specific network behaviours should inherit from this class (or from SingletonNetworkBehaviour<T>).

The class integrates with Paragon's debug system by implementing IDebugObject:

  • On OnEnable(), the object registers itself with Debug.Register().

  • On OnDisable(), the object unregisters with Debug.Unregister().

  • The virtual OnDebug() method can be overridden to render custom debug information (e.g., Gizmos, GUI).

The NetworkManager property shadows the inherited NetworkBehaviour.NetworkManager to return the Paragon NetworkManager singleton instead of Unity's.

Quick Lookup

Goal
How

Get local client ID

ClientID (static)

Access NetworkManager

this.NetworkManager (returns Paragon's singleton)

Enable debug for this object

debugEnabled = true (Inspector toggle)

Add custom debug rendering

Override OnDebug()

Properties

ClientID (static)

The local client's network ID. Shortcut to NetworkManager.ClientId.

NetworkManager

The Paragon NetworkManager singleton. Shadows the base class property.

DebugEnabled

Whether debug output is enabled for this specific instance. Controlled via a hidden [SerializeField] in the Inspector.

Methods

OnDebug (virtual)

Called by the Paragon debug system when debug rendering is active. Override to draw Gizmos, log state, or render debug GUI.

Extension Points

Optional Overrides

Method
Purpose

OnEnable()

Registers with debug system. Call base.OnEnable() if overriding.

OnDisable()

Unregisters from debug system. Call base.OnDisable() if overriding.

OnDebug()

Render custom debug visuals when DebugEnabled is true.

Implementation Requirements

When subclassing ParagonNetworkBehaviour, you MUST:

  1. Call base.OnEnable() if overriding OnEnable() (to maintain debug registration)

  2. Call base.OnDisable() if overriding OnDisable() (to maintain debug unregistration)

You SHOULD:

  • Use ClientID for local client checks instead of accessing Netcode APIs directly

  • Use this.NetworkManager for Paragon-level network operations

  • Override OnDebug() for development-time debug visualization

Common Pitfalls

circle-exclamation
circle-exclamation

Examples

Basic Network Behaviour

See Also

Last updated