Skip to main content

Type Alias: UiAxisSizeUnit

UiAxisSizeUnit = "referencePixels" | "screenPixels"

Defined in: ui/types/ui-axis.ts:14

The unit a UiPointAxis.size/UiStretchAxis.margin value is expressed in. 'referencePixels' (the default) scales with the owning canvas's live scale factor, exactly like everything else in the anchor system - unchanged behavior. 'screenPixels' instead stays a literal, unscaled device pixel count, converted to reference pixels fresh every frame (via createUiLayoutEcsSystem's own pixelsPerUnit, the same conversion calculatePixelsPerUnit gives createUiSafeAreaEcsSystem) - useful for an element that should keep a constant on-screen size regardless of the canvas's scaleMode/reference resolution or the destination's aspect ratio, such as a fixed-width sidebar inside an otherwise scaleWithScreenSize/ fitReferenceResolution-scaled canvas.