Resizable
Allows resizing gameobject by size or scale.
Options
Interactable
bool
Allow users to change the size of the GameObject.
Resize Directions
Resizable.Directions
Allowed resizing directions.
Type
ResizeType
Resize type.
Size
Resize by changing size of the gameobject.
Scale
Resize by changing scale of the gameobject.
Include Corners
bool
Allow resize when cursor in the one of the corners. Should be disabled to use together with Rotatable component.
Integer Size
bool
If enabled size is rounded to the integer number. Reason: size can be float number if gameobject is rotated.
Update RectTransform
bool
Change RectTransform size.
Update LayoutElement
bool
Change LayoutElement size.
Active Region
float
Distance from border where resize allowed.
Min Size
Vector2
Minimal size in points, for the
Scale
type limits is checked against width * scale.x and height * scale.y.Max Size
Vector2
Maximum size in points, for theScale
type limits is checked against width * scale.x and height * scale.y.Not applied if size is zero.Stop At Parent Borders
bool
If enabled then the component cannot be resized to exceed the parent borders.
Keep Aspect Ratio
bool
Aspect ratio applied after MinSize and MaxSize, so if default aspect ratio not equal MinSize and MaxSize aspect ratio then real size may be outside limit with one of the axis.
Cursors
Cursors
Custom cursors to the allowed resize state.
Snap Grids
List<SnapGridBase>
Snap Distance
Vector2
Maximum distance to lines where snapping is available.
Events
OnStartResize
UnityEvent<Resizable>
OnResize
UnityEvent<Resizable>
OnEndResize
UnityEvent<Resizable>
OnResizeDelta =
UnityEvent<Resizable, Resizable.Regions, Vector2>
OnResizeDirectionsChanged
UnityEvent<Resizable>
OnTargetChanged
UnityEvent<Resizable>
Properties
Target
RectTransform
Target to resize; the self is by default.
Resize Children With Parent
There are a few ways to resize children with parent:
Use
RectTransform anchors
to set children size relative to parent with padding from borders.Probably setting anchors to horizontal stretch (for the labels or buttons) or horizontal and vertical stretch (for the long text or ListView) will be enough.
Video about anchors.
Add Layout Group (
Horizontal Layout Group
,Vertical Layout Group
,Grid Layout Group
, EasyLayout) to parent with enabledControl Child Size
options.It is a more complex way, and it will be harder to achieve the desired result.
If you want to add/remove/enable/disable children from a script and automatically reposition them after this, then Layout Group is the right way to do this.