What is Automatic Size?
Automatic Size is a property that can be applied to any UI object. It is used to automatically size parent UI objects based on the size of its descendants. By applying this property, you can dynamically add text and other content to a UI object at edit or run time, and the size will adjust to fit that content. Automatic Size is particularly useful for UI that’s driven by dynamic content.
Documentation
For additional details on how to use AutomaticSize
with your UI, please visit the following Dev Hub pages:
Property and Values
With Automatic Size, all GuiObjects have a new Enum property named AutomaticSize
. This property can have the following values:
Property Value | Description |
---|---|
None | Default sizing behavior |
X | Resize along the X axis to fit child content |
Y | Resize along the Y axis to fit child content |
XY | Resize along both the X and Y axes to fit child content |
Basic Examples
A TextLabel whose AutomaticSize
property is ‘X’:
A TextLabel whose AutomaticSize
property is ‘Y’ (and TextWrapped enabled):
Known Issues
The following issues occur regardless of whether Automatic Size is being used:
- In some games, resizing the window can cause UI elements to overlap each other.
- ScrollingFrames containing UIGridLayouts affected by UIAspectRatioConstraints will cause elements to display incorrectly.
When using Automatic Size, we are aware of the following issues :
-
AutomaticCanvasSize
incorrectly sizes canvas with scaled child positions. - Automatically sized parent may not respect child size constraints.
- Automatically sized parent of a ScrollingFrame with
AutomaticCanvasSize
may resize incorrectly - Automatically sized elements may overflow their parent bounds
- Scaled text with automatic size doesn’t respect UIPadding
-
AutomaticCanvasSize
doesn’t respect UIPadding of UIGridLayout - Inset and middle borders are incorrectly accounted for in automatic size
- Automatically sized parents with scaled size and scaled-sized children are incorrectly resized
Please report any issues that you find, along with general feedback, as a reply to this post and we will add new issues to the list.
Thanks
BIG thanks to everyone who participated in the Automatic Size studio beta! Your participation, feedback, and bug reports helped immensely.