- Home /
Help moving left side of Rect Transform
Having trouble finding an answer to this on the internet, maybe you guys can help me :)
I need a rect transfrom to move its "left" position. I say left because it is the child of another gui object, and its anchors are set to the outer edges of this object. Thus I cannot actually modify its 'x' or 'y' value directly. In this code, Bar is casted as a RectTransform, and increment is the distance I want it to move each frame.
Bar.sizeDelta=new Vector2(Bar.localPosition.x-increment, Bar.localPosition.y);
this code is not what doing what I want it to do, How do I move ONLY the left side of this object (think expanding an image horizantally over time, but the image stays anchored to its 'right' position)?? Thanks!
Your answer
![](https://koobas.hobune.stream/wayback/20220613174346im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Incorrect RectTransform width value when trying to read child RectTransform width. 0 Answers
Getting the width of UI text inside a layout allways 0. 1 Answer
Get the x-axis and width of the rendered UI Image and NOT the values of the rect transform. 0 Answers
RectTransform.rect.Set doesn't work! 1 Answer
How would I connect the width of an image (in rect transform) to an int? 1 Answer