Page 1 of 1

Text Box Adjust to Text Amount

Posted: Wed Oct 07, 2020 3:57 pm
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

Re: Text Box Adjust to Text Amount

Posted: Wed Oct 07, 2020 3:59 pm
by Tony Li
Hi Nathan,

Try adding a Content Size Fitter to it. Set the Vertical and Horizontal dropdowns to Preferred.

Re: Text Box Adjust to Text Amount

Posted: Wed Oct 07, 2020 7:29 pm
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

Re: Text Box Adjust to Text Amount

Posted: Wed Oct 07, 2020 8:25 pm
by Tony Li
Glad to help!