text not staying inside buttons

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
cristoo
Posts: 6
Joined: Sun May 29, 2022 5:30 am

text not staying inside buttons

Post by cristoo »

Hi does anyone know why my text isn't staying inside the buttons? I have wrap, truncate and best fit checked.
I have tried so many combinations of settings and haven't found a solution yet.
Any help would be much appreciated.
You can see what I mean in the bottom two player response buttons on this experiment.
Attachments
buttonss.jpg
buttonss.jpg (348.18 KiB) Viewed 153 times
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: text not staying inside buttons

Post by Tony Li »

Hi,

You may need to add some padding on the top and bottom of the button. Here's an example:

padResponseText.png
padResponseText.png (125.07 KiB) Viewed 127 times

This button happens to use a Vertical Layout Group. Notice that the Top and Bottom padding move the text in from the top and bottom edges of the button image. Otherwise the text would overlap the top edge of the button image.

If you're not using a Vertical Layout Group, you can inspect the text GameObject itself and instead of the padding of its Rect Transform instead.

In addition, it will help to set the text's vertical alignment to middle instead of top.
Post Reply