- Home /
Issue with size of sprite in Canvas
Hello,
I have a problem with an UI image in my scene. It happens when I use "Canvas.ForceUpdateCanvases();" in my script.
When i change the sizeDelta of my GameObject in my script or even in the scene when playing, the sprite keeps his size, like this. Do you know what could cause this exactly and how i could fix it ? Thanks.
Answer by JonPQ · Aug 20, 2019 at 07:56 PM
you are changing the size of the 2D rectTransform container, not of your object. see that icon in top left (that says scale/center), change it to be Scale to fit icon. instead of just 'position sprite in center' as you have it now.
Where do you see the "scale/center" icon ? I don't find it.
yep that ^ thanks. "Rect transforms" are very different from "Transforms", and well worth reading up on how they work. Note:- I should have said "middle-center" ins$$anonymous$$d of "scale-center"