void Text( Vector3 position, string text, float size, TextFlag flags, Color color, float duration, Transform transform, bool overlay )
void Text( Vector3 position, Sandbox.TextRendering/Scope scope, TextFlag flags, float duration, Transform transform, bool overlay )

book_4_sparkGenerated
code_blocksInput

Description

The Text method of the DebugOverlaySystem class is used to draw text in the 3D world space. This method allows you to specify the position, content, size, and appearance of the text, as well as how long it should be displayed.

Usage

To use the Text method, you need to provide the following parameters:

  • position: A Vector3 indicating the world position where the text should be drawn.
  • text: A string containing the text to be displayed.
  • size: A float representing the size of the text.
  • flags: A TextFlag enumeration value that specifies text rendering options, such as alignment and style.
  • color: A Color object that defines the color of the text.
  • duration: A float indicating how long the text should remain visible, in seconds.
  • transform: A Transform object that can be used to apply additional transformations to the text.
  • overlay: A bool indicating whether the text should be drawn as an overlay, which means it will always appear on top of other objects.

Example

// Example of using the Text method to draw text in the world
DebugOverlaySystem debugOverlay = new DebugOverlaySystem();

Vector3 position = new Vector3(0, 0, 0);
string text = "Hello, World!";
float size = 12.0f;
TextFlag flags = TextFlag.Center;
Color color = Color.White;
float duration = 5.0f;
Transform transform = Transform.Identity;
bool overlay = true;

debugOverlay.Text(position, text, size, flags, color, duration, transform, overlay);