UIAspectRatioConstraint¶
Ensures the parent UI element maintains a particular aspect ratio.
Not implemented yet
Aspect-ratio constraints are not implemented.
Workaround: Recompute Size in response to AbsoluteSize changes.
Description¶
The UIAspectRatioConstraint enforces a width‑to‑height aspect
ratio on a GuiObject regardless of its core size, even if that size is
set as a percentage of its parent. For example, inserting this constraint as a
child of a Frame and setting the constraint's
AspectRatio property to 2
(2:1) keeps the frame's width at twice that of its height. Similarly,
setting this constraint's
AspectRatio property to 0.5
(0.5:1) keeps the frame's width at half that of its height.
Setting this constraint's
AspectRatio to the default of 1
(1:1) is a convenient way to prevent non‑proportional scaling/stretching of
an ImageLabel with a square image asset.
Note that when a UI object is under control of both a layout structure such as UIListLayout and a UIAspectRatioConstraint, the constraint will override the layout and control the object's size.
Inheritance¶
Object → Instance → UIBase → UIComponent → UIConstraint → UIAspectRatioConstraint
Properties¶
| Member | Signature | Summary |
|---|---|---|
AspectRatio |
AspectRatio: float |
Determines the width-to-height ratio to maintain. |
AspectType |
AspectType: AspectType |
Determines how the maximum size of the object is limited. |
DominantAxis |
DominantAxis: DominantAxis |
Determines the axis to use when setting the new size of the object. |
Roblox reference: UIAspectRatioConstraint
Generated from Nova's API dump and Roblox creator-docs. Nova-only members come from the engine's reflection metadata.