Skip to content

Type Alias: WidgetEdgeValue ​

ts
type WidgetEdgeValue = number | string | null;

Anchor a UI entity to a chosen rect (default: the host's parent UITransform). Edges (top/bottom/left/right) are offsets from the corresponding rect edge, or null to leave unanchored. Setting BOTH opposite edges stretches: the entity's UITransform width/height is rewritten to span between them and horizontalCenter/verticalCenter is ignored on that axis.

Anchor target (anchorTarget):

  • null — use the host's hierarchy-parent UITransform (default; backward compatible).
  • EntityId — anchor to any entity's UITransform regardless of hierarchy.
  • 'window' — anchor to the visible screen in design-space coordinates. Use SetAnchorTarget(entity | id | 'window' | null) to set this safely from either an Entity object or a raw id.

Values (each edge / center) can be:

  • number — pixel offset. Negative values place the edge OUTSIDE the rect (stretch beyond).
  • string with "%" suffix (e.g. "50%", "-10%") — percent of the relevant axis (height for top/bottom/verticalCenter, width for left/right/horizontalCenter).
  • null — unanchored on that edge.

Per-axis priority: opposite-pair > single edge > center > untouched.

The align* booleans gate each anchor independently — a false flag treats that edge/center as unanchored regardless of its stored value, so an offset can be toggled off without losing it.

© 2026 PlayAdGentic