S&box Wiki

Overview of DebugOverlay

Overview of the DebugOverlay System

The debug overlay system in s&box is very easy to use and fairly useful for debugging purposes, below is a example of how you can draw debug screen text and a sphere using DebugOverlay.ScreenText() you can find all other DebugOverlay methods here

In this example we'll simply be using the OnUpdate() method to call our DebugOverlay ScreenText and OnStart for the Sphere.

protected override void OnStart() { // Sphere will disappear after 5 seconds DebugOverlay.Sphere(new Sphere(Vector3.Zero, 10f), Color.Green, 5f); } protected override void OnUpdate() { const string name = "Cool Game!"; DebugOverlay.ScreenText(new Vector2(400, 500), $"This is my {name}"); }

Below is the result of the code snippet in the scene.

image.png