Text Box Adjust to Text Amount

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Text Box Adjust to Text Amount

Post by nathanj »

Hi Tony

I'm sure this has been discussed before but I haven't been able to find it.

What I'm trying to do is have a Image box behind my dialogue text that scales based on the volume of text. So if there is a lot of text the box increases in size to cover the whole area but if it is just a single word the image size is small.

Thank you,
Nathan
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Text Box Adjust to Text Amount

Post by Tony Li »

Hi Nathan,

Try adding a Content Size Fitter to it. Set the Vertical and Horizontal dropdowns to Preferred.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Text Box Adjust to Text Amount

Post by nathanj »

Perfect, thanks Tony!

Also, incase anyone else would like the, here is a useful page: https://docs.unity3d.com/Packages/com.u ... tSize.html
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Text Box Adjust to Text Amount

Post by Tony Li »

Glad to help!
Post Reply