- Home /
Scaling problem with image on buttons.
I am having some trouble with the image scaling on my wide buttons. My understanding of 9-slice sprites is that the corners don't get scaled, only the edges and center, but that is not what I am seeing. Both buttons are using the same source image, but the wider button's corners are about twice as wide as they should be:
This is what it looks like when I set the image type to simple:
I get the feeling that I am missing something, but not sure what. The sprite is 64x64 with the all borders set to 20.
Are you able to access the sprite editor? I had a similar problem with menu sprites a while ago, if you move the lines to the inside of where you don't want stretching to occur it should solve the problem, I learnt this from 3dbuzz. edit - don't forget to hit apply after making sure the box only includes the inside areas of your sprite, also I don't know how to add images to the comments in unity, I just drew a rough draft of what I meant.
Yes, the borders are set inside of where I want the cut made, I verified them to make sure. Good suggestion, but that is not it.
Answer by ZeFirestarter · May 28, 2015 at 02:46 PM
Try modifying the Width instead of the Scale of the button.
Did this, and the edges of the button are still stretched.
PS: Not sure why, but my Buttons' RectTransforms are showed in inspector with Left, Right, Top and Bottom ins$$anonymous$$d of X, Y, Width and Height.