Text Box not Scaling with Parent Button

Hello. I have a button with its anchors set up like this, so that it will scale with the canvas, and it does.

2495367--172259--Screen Shot 2016-02-03 at 7.11.50 PM.png

The text ( whose is child to the button), is set up like this, so that the box is supposed to scale with the button.

2495367--172262--Screen Shot 2016-02-03 at 7.12.07 PM.png

But when I resize the canvas, the text box size for the buttons text stays the same even though the button is resizing.
2495367--172261--Screen Shot 2016-02-03 at 7.12.41 PM.png
The text box is selected in the hierarchy. As shown, the text box is not scaling with the button.
Why is this happening?

Do you have best fit enabled on text? Try lowering the minimum size

Yes I have best fit enabled and the minimum size is set to zero.

The text is parented to the button? Can you share the sample as a unitypackage?

I attached to this post what I think you’re asking for. Thanks

2496830–172448–Button.unitypackage (2.02 KB)

You should leave the border values at zero to get scaling how you want. If you need to adjust things use the anchors so that it scales correctly.
Like so:
2496854--172452--1.gif

Setting the border values to zero works and resizing the button using its anchors keeps the border values at zero. Thanks.

1 Like

I’m still having trouble getting this to work consistently, so I sought to further my understanding of how anchors and Rect Transforms work.

Watching the UI Rect Transform tutorial, it said that Left Top Right Bottom is the distance between the anchors rect and the rect transform as shown by the image.

When applying this to my text,


I can’t see why Right is -10.5 when the borders are so close as with all the other borders.