Class EntityTextProcessor
- Namespace
- Stride.CommunityToolkit.Rendering.Text
- Assembly
- Stride.CommunityToolkit.dll
Keeps track of every EntityTextComponent in the scene for the text renderer to draw.
public class EntityTextProcessor : EntityProcessor<EntityTextComponent, EntityTextRenderData>
- Inheritance
-
EntityTextProcessor
- Inherited Members
Remarks
Registered automatically through the DefaultEntityComponentProcessor attribute on the
component, so nothing needs to add it by hand.
It replaces the renderer walking the scene's entity list each frame, which had two consequences worth naming because both looked like the renderer being broken. Only top-level entities were ever visited, so a label added as a child of another entity - the obvious way to attach a label to a thing - never drew at all. And the cached text measurements were keyed on entities that the renderer had no way of knowing had been removed, so every short-lived label leaked one entry. Collection through a processor fixes both: the engine reports components arriving and leaving wherever they sit in the hierarchy.
Properties
Texts
Gets every text currently in the scene, in no particular order.
public IReadOnlyList<EntityTextRenderData> Texts { get; }
Property Value
Methods
GenerateComponentData(Entity, EntityTextComponent)
protected override EntityTextRenderData GenerateComponentData(Entity entity, EntityTextComponent component)
Parameters
entityEntitycomponentEntityTextComponent
Returns
IsAssociatedDataValid(Entity, EntityTextComponent, EntityTextRenderData)
protected override bool IsAssociatedDataValid(Entity entity, EntityTextComponent component, EntityTextRenderData associatedData)
Parameters
entityEntitycomponentEntityTextComponentassociatedDataEntityTextRenderData
Returns
OnEntityComponentAdding(Entity, EntityTextComponent, EntityTextRenderData)
protected override void OnEntityComponentAdding(Entity entity, EntityTextComponent component, EntityTextRenderData data)
Parameters
entityEntitycomponentEntityTextComponentdataEntityTextRenderData
OnEntityComponentRemoved(Entity, EntityTextComponent, EntityTextRenderData)
protected override void OnEntityComponentRemoved(Entity entity, EntityTextComponent component, EntityTextRenderData data)
Parameters
entityEntitycomponentEntityTextComponentdataEntityTextRenderData