SetLocalTop(float, bool)
Moves the top edge of this RectTransform to the specified position in its parent's coordinate space.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public void SetLocalTop(float value, bool preserveSize = true)
Parameters
The target y coordinate for the top edge, in the parent's coordinate space.
When true (default), the element translates so the top edge reaches while height is unchanged. When false, only the top edge moves: the bottom edge stays fixed and RectTransform.sizeDelta is adjusted to match the new height.
valueRemarks
When is true, adjusts RectTransform.anchoredPosition so that RectTransform.GetLocalTop returns ; the element's size (RectTransform.sizeDelta) and bottom edge are not affected. When is false, the bottom edge remains at its current position and the height is resized to reach .
preserveSizevaluepreserveSizevalueAdditional Resources: RectTransform.GetLocalTop, RectTransform.SetLocalBottom.