- Home /
Question by
streeetwalker · Jan 25, 2021 at 09:32 PM ·
canvasui image
LeanTween scale UI from center?
Anyone using LeanTwean have any experience with scaling UI RectTransforms?
I have a UI image set smack dab in the middle of my canvas, with the anchor set to stretch from center in both dimensions; and with the pivot at the center (0.5, 0.5).
When I LeanTween.scale from 0,0,0 to 1,1,1 it seems to scale from the bottom-center of the image upward rather than outward from the center.
Any ideas what could be going on there?
Comment
The following code works perfectly fine for me. Maybe try to set up a new Canvas and see if it works there. If it does, maybe your Parent- or Canvas-Setup is messing with the result.
void Start()
{
this.transform.localScale = Vector3.zero;
LeanTween.scale(this.gameObject, Vector3.one, 1f);
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613024007im_/https://answers.unity.com/themes/thub/images/avi.jpg)