Stratkit UI Entities¶
Draws world-space UI authored as UGUI prefabs as instanced quads, without canvases.
- Bake (
Editor): a UGUI prefab is baked into aUiTemplateAsset: its RectTransforms, layout components (layout groups,ContentSizeFitter,LayoutElement), graphics (Image,Outline,SpriteDigitsGraphic) and effects. Game components plug in throughIUiEntitiesNodeBaker. - Instances (
Runtime): aUiInstanceentity holds the state of every node of its template (UiNodeState). Feature code changes node state (active, colour, sprite, fill, number...) and marks the instance dirty;UiLayoutSystemthen runs the port of the UGUI layout and writes the geometry of every graphic into the instance's range of theUiElementPool(oneUiElementGpuper quad), mirrored in a GPU buffer. - Drawing:
UiRenderSystemsorts the instances back to front every frame withUiSort, a stable natural merge sort that costs one pass while last frame's order still holds (panning, zooming) and O(n log n) at worst, then draws every element in oneGraphics.RenderMeshPrimitivescall per draw group (a base material with up to 8 sprite textures): the elements of an instance in slot order, the instances back to front, so overlapping UI blends as on a canvas. The shader includesShaders/UiEntities.hlsl, which reads the element and its instance matrix from structured buffers bySV_InstanceID. Nothing is rebuilt when an instance moves, scales or changes a colour; instances are not culled on the CPU, every camera draws them with its own frustum.
The geometry and layout follow the UGUI sources (Image, LayoutGroup, HorizontalOrVerticalLayoutGroup,
LayoutUtility, ContentSizeFitter, LayoutRebuilder) so the result matches the canvas pixel for pixel.