Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SetLocalBottom(float, bool)

Moves the bottom edge of this RectTransform to the specified position in its parent's coordinate space.
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public void SetLocalBottom(float value, bool preserveSize = true)

Parameters

value

The target y coordinate for the bottom edge, in the parent's coordinate space.

preserveSize

When true (default), the element translates so the bottom edge reaches
value
while height is unchanged. When false, only the bottom edge moves: the top edge stays fixed and RectTransform.sizeDelta is adjusted to match the new height.

Remarks

When
preserveSize
is true, adjusts RectTransform.anchoredPosition so that RectTransform.GetLocalBottom returns
value
; the element's size (RectTransform.sizeDelta) and top edge are not affected. When
preserveSize
is false, the top edge remains at its current position and the height is resized to reach
value
.