API Reference · Overlays and labels
LabelNode
public class LabelNode : SpriteNodeA line of text standing in the scene: a nameplate on a hull, a sign on a bulkhead, a caption on a plinth.
The other half of , and the half it cannot do. An overlay places a real Avalonia control over the picture, which keeps text at the device's own resolution and is what almost every label should be. What it cannot do is be *in* the scene: occluded by the wall in front of it, shrinking with distance, fogged — or photographed, because a frame grab is the renderer's own surface and an overlay is not in it. This is for the labels that have to be part of the picture.
It is a SpriteNode with its texture made from a string, so everything a sprite does it does: SpriteNode.DepthTest decides whether the wall hides it, SpriteNode.Blend and SpriteNode.Opacity decide how it sits on what is behind, Node.RenderOrder decides what it draws over. The quad faces the camera and its edges stay parallel to the viewport's, which is what a label wants and is why this is a sprite rather than a mesh.
var plate = new LabelNode
{
Text = "COBRA MK III",
Options = new TextOptions { Size = 48, Outline = 3, Typeface = face },
Height = 0.12f, // world units, the whole plate
Position = new Vector3(0, 1.8f, 0),
};The picture it produces is the platform's idea of the face unless TextOptions.Typeface carries one — see that property, because it is the one thing in this library that is not the same on every machine.
Properties
| Member | Description |
|---|---|
| How tall the label stands in the world, in world units. A tenth by default. The width follows from what the text measured, so a label is never stretched and a longer string is a wider plate rather than a squashed one. This is the number that decides how large it is; the number in |
| The face, the ink and the outline. See |
| The words. Setting it redraws the texture and re-proportions the quad, so a label whose text changes stays the right shape — which is the whole reason the measuring belongs in the library. It is not free: a set is a Skia raster and a texture upload, so a readout that changes every frame wants |