- Home /
Adjusting size of the text to fit panel
Hello, i was trying to make an black background auto-adjust to fit the text size, like Subway Surfers style coins text, but i cant... I searched around and tried to use the panel / horizontal layout group / content fitter but i cant... Can anyone give me a detailed explanation step to step ??? Thanks !!!
Print:
Answer by jeffreyrampineda · Nov 24, 2017 at 05:02 AM
Make an empty GameObject container to hold both the "Coins Text" and the "Coins Image"
Add Horizontal Layout Group on the container
Add Content Size Fitter on the container
Set Content Size Fitter's Horizontal Fit to "Preferred Size" (or set Vertical Fit as well if you want)
(Optional) Set Horizontal Layout Group's Padding left, right, top, bottom to 10
(Optional) Set Horizontal Layout Group's Spacing to 10