How to change "Left" variable in RectTransform

115960-1111.jpg
I was wondering how I could change the “Left” variable of a RectTransform thought code. Thanks!

Modifying rect transform via script is possible but not very straight forward. The left and right can be changed from size delta which is dependent to anchors.


To understand this better, change your inspector from normal view to debug view. Pick one of your UI object (it should have the rect transform component). Then you can see the available fields. You can access that fields using getcomponent, for ex. GetComponent().sizeDelta


How to change from normal to debug view (i marked with red circle)