Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetLocalRight()

Returns the x coordinate of the right edge of this RectTransform in its parent's coordinate space.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public float GetLocalRight()

Returns

Type

Description

floatThe x coordinate of the right edge, measured from the lower-left corner of the parent RectTransform's rect. If there is no parent RectTransform, returns the value relative to the element's own rect origin.

Remarks

All four edge-position methods — RectTransform.GetLocalBottom, RectTransform.GetLocalTop, RectTransform.GetLocalLeft, and RectTransform.GetLocalRight — share the same coordinate system, whose origin is at the lower-left corner of the parent rect. Use RectTransform.SetLocalRight to move the right edge to a specific position without changing the element's size.