Table of Contents

Class EntityTextRenderer

Namespace
Stride.CommunityToolkit.Rendering.Compositing
Assembly
Stride.CommunityToolkit.dll

A custom scene renderer that renders 2D text and a background for each entity in the scene. This class demonstrates how to use SpriteBatch for 2D rendering within a 3D scene.

public class EntityTextRenderer : SceneRendererBase, IComponent, IReferencable, ICollectorHolder, ISceneRenderer, IRenderCollector, IGraphicsRenderer, IGraphicsRendererBase, IGraphicsRendererCore, IDisposable
Inheritance
EntityTextRenderer
Implements
Inherited Members

Remarks

This renderer uses SceneRendererBase to hook into the Stride rendering pipeline, rendering text above each entity with details like the entity's name and position. The renderer demonstrates both dynamic text rendering. This is useful for debugging or displaying information in a game scene. The text change isn't supported at the moment. Use it just for static text.

Methods

Destroy()

Cleans up resources used by the renderer, such as the sprite batch and background texture.

protected override void Destroy()

DrawCore(RenderContext, RenderDrawContext)

Performs the actual drawing of the scene, including rendering text and backgrounds for each entity. This method is called every frame.

protected override void DrawCore(RenderContext context, RenderDrawContext drawContext)

Parameters

context RenderContext

The rendering context that contains information about the current frame.

drawContext RenderDrawContext

The draw context used for issuing draw commands to the graphics card.

InitializeCore()

Initializes the renderer by loading necessary resources like fonts and creating a SpriteBatch for rendering 2D elements.

protected override void InitializeCore()