Description
The DebugOverlay
property of the Component
class provides access to the DebugOverlaySystem
, which allows for the drawing of temporary debug shapes and text within the scene. This can be particularly useful for visualizing data or debugging complex interactions within your game environment.
Usage
To use the DebugOverlay
property, you can access it from any instance of a Component
or its derived classes. This property is not static, so it requires an instance of a component to be accessed.
Once accessed, you can use the methods provided by the DebugOverlaySystem
to draw shapes, lines, or text in the scene for debugging purposes.
Example
// Example of using DebugOverlay in a custom component
public class MyComponent : Component
{
public override void OnComponentUpdate()
{
// Draw a line from the component's position to a point 10 units above it
DebugOverlay.Line( Transform.Position, Transform.Position + Vector3.Up * 10, Color.Red );
// Draw text at the component's position
DebugOverlay.Text( "Hello, World!", Transform.Position, Color.White );
}
}