UIWorldLabel Class
Definition
Namespace: Brine2D.UI
World-space text label projected to screen space by UICanvas each frame. Typical uses: floating name tags, damage numbers, waypoint markers.
Inheritance System.Object → UIWorldLabel
Implements IUIWorldComponent, IUIComponent
Remarks
Add via AddWorldComponent\(IUIWorldComponent\) and set WorldPosition
to the world-space anchor point \(e\.g\. the entity's position\). The canvas converts
this to screen coordinates using WorldCamera before rendering.
Use ScreenOffset to nudge the label relative to its projected point
(e.g. new Vector2(-Size.X / 2, -40) to centre it 40 px above).
| Properties | |
|---|---|
| BackgroundColor | Background fill color \(only drawn when [BackgroundPadding](BackgroundPadding.md 'Brine2D\.UI\.UIWorldLabel\.BackgroundPadding') \> 0\). |
| BackgroundPadding | Optional background padding around the text. When > 0, a filled rectangle is drawn behind the text using BackgroundColor. |
| BorderColor | Optional border color drawn around the background \(requires [BackgroundPadding](BackgroundPadding.md 'Brine2D\.UI\.UIWorldLabel\.BackgroundPadding') \> 0\). |
| BorderThickness | Border thickness. Only used when BorderColor is set. |
| CullWhenOffScreen | Hides the component when its projected position falls outside the viewport. Defaults to true. |
| Font | Font. null uses the renderer default. |
| MaxWidth | Maximum text width before wrapping. 0 = no wrap. |
| ScreenOffset | Pixel offset applied after world-to-screen projection. Use to nudge the component relative to its anchor — e.g. new Vector2(-Size.X / 2, -40) to centre it 40 px above the world point. |
| Text | Text to display. |
| TextColor | Text color. Defaults to white. |
| WorldPosition | Position in world space. Projected to screen coordinates via WorldCamera before each render pass. |