Skip to content

VixCore Debug Overlay

Namespace: VixCore.Overlay

DebugOverlay displays runtime debug text from registered providers using UI Toolkit.

Setup

  1. Create a GameObject in the first loaded scene.
  2. Add DebugOverlay.
  3. Make sure the GameObject also has a UIDocument.
  4. Assign the included DebugOverlayPanelSettings asset.
  5. Enter Play Mode and press the configured toggle key. The default key is F3.

The overlay object is kept alive with DontDestroyOnLoad.

Creating a Provider

Implement IDebugProvider.

using UnityEngine;
using VixCore.Overlay;

public class PlayerDebugProvider : MonoBehaviour, IDebugProvider
{
    [SerializeField] private Rigidbody body;

    private void OnEnable()
    {
        DebugOverlay.RegisterProvider(this, priority: 10, name: "Player");
    }

    private void OnDisable()
    {
        DebugOverlay.UnregisterProvider(this);
    }

    public string GetDebugInfo()
    {
        if (body == null)
            return "No Rigidbody assigned";

        return $"Velocity: {body.linearVelocity}";
    }
}

Provider Ordering

Higher priority providers are shown first.

DebugOverlay.RegisterProvider(this, priority: 100, name: "Important");

Notes

  • Providers should unregister in OnDisable.
  • GetDebugInfo() is called while the overlay is visible, so keep it cheap.
  • Empty provider names fall back to the provider type name.