Figure: Example hierarchy: the parent Layout Group controls the Slot position and size; scripts or animation move only the nested Visual. Layout Element supplies preferred sizes, not a guaranteed final size.
Figure: Example hierarchy: the parent Layout Group controls the Slot position and size; scripts or animation move only the nested Visual. Layout Element supplies preferred sizes, not a guaranteed final size.

Find who writes the RectTransform

In uGUI, RectTransform stores a UI element's position and size. If an edit is undone, check whether automatic Layout, an Animator, or a script also writes those values. This guide covers Unity 2022.3 LTS uGUI, separately from UI Toolkit.

A parent Layout Group controls its children; a Content Size Fitter controls its own RectTransform size. Inspect driven properties and the settings for each axis.

1. Inspect the parent group and its axes

Trace Horizontal, Vertical or Grid Layout Groups up the hierarchy. For Horizontal/Vertical groups, inspect Control Child Size for Width and Height separately. Disabling size control on an axis does not also release placement control.

Use a Layout Element to supply Min, Preferred and Flexible size inputs. Preferred Width is not a guaranteed final width: available space, Padding, Spacing, siblings, Child Force Expand and flexible sizes also matter.

Separate owners
Separate owners

2. Resolve Content Size Fitter conflicts per axis

A parent controlling a child's width can compete with that child's Horizontal Fit. Choose one owner for that dimension. Unconstrained means the Fitter does not drive that axis.

A Layout Group and Content Size Fitter are not universally incompatible. On the same object, the Fitter can size the object while the group arranges its children. Conflicts arise when controllers write the same property of the same RectTransform.

Separate owners
Separate owners

3. Separate the layout Slot from its Visual

For selection bumps or shaking list items, place a Visual under the layout-controlled Slot and animate that child. The diagram shows the parent allocating the Slot while animation changes only the nested Visual.

This assumes no other layout component drives the same Visual properties. Scaling the Visual alone does not normally enlarge the Slot's layout allocation. Inspect sibling overlap, clipping masks and raycast areas; reserve extra Slot space when the effect needs it.

Separate owners
Separate owners

4. Check timing, anchors and pivot

Layout recalculations are normally batched before rendering. Reading rect immediately after changing text can return the previous size. First inspect the result after the normal rebuild.

Custom layout code can request a delayed update with LayoutRebuilder.MarkLayoutForRebuild. ForceRebuildLayoutImmediate is an option for specific immediate calculations, but repeatedly forcing it does not resolve competing ownership.

If resizing grows in the wrong direction, inspect the Pivot. With stretched anchors, sizeDelta is the size difference relative to the parent anchor span, not simply the displayed width. Separate parent or Canvas changes from layout writes.

Separate owners
Separate owners

Verify the correction

  1. Assign one owner per driven property and axis.
    Separate owners
    Separate owners
  2. Check short/long text, item insertion/removal and viewport changes after recalculation.
    Separate owners
    Separate owners
  3. Check selection and entry effects for overlap or clipping.
    Separate owners
    Separate owners
  4. Profile layout work if adding immediate rebuilds.
    Separate owners
    Separate owners

See ScrollRect cell recycling for long lists and the Canvas rebuild guide for performance checks.

References