Unity Quick Tips - How to Dynamically RESIZE Text UI

Опубликовано: 18 Октябрь 2024
на канале: The Messy Coder
11,452
80

Unity Quick Tips - How to Dynamically RESIZE Text UI
► Twitch =   / themessycoder  
► Unity3D asset store = http://bit.ly/themessystore
► Discord =   / discord  

Grab the sample code here: https://pastebin.com/kkrWh8w2

Thanks to @Sam3DX I can now do this with native Unity UI features :D
You need to add a Vertical layout group to the parent object and set the following values:
Control Child Size: Width + Height
Child Force Expand: Width

Add a Content Size Fitter to the same parent object with values:
Horizontal Fit : Unconstrained
Vertical Fit: Preferred Size



Shoutout to itsOiK ►   / itsoik  

---------------------------------------------

Shameless plug, click my links for the assets to support the channel. The Unity Affiliate program helps drive a little cash back in to the Messy wagon and enables me to buy more assets to review, and also to put the heating on.

Thanks for your love and support, and happy deving!

► Subscribe on YouTube : http://bit.ly/messytube
► Follow Me on Twitter :   / themessycoder  

Come and watch me on my live stream over at Twitch, where every Fridays & Saturdays I broadcast playing, developing and doing live game dev interviews.
You can also learn how to make your own games!

►   / themessycoder  

If you Sub on Twitch you get access to my tutorial code on the discord, just link your twitch and discord, come and say hi :)

► Discord =   / discord  

---------------------------------------------------------------------

If you want to support the channel, please feel free to pop over to twitch and click on that subscribe button :) for the price of a fancy coffee you can help the channel grow

► http://bit.ly/messysub


---------------------------------------------------------------------

If you are interested in other Survival asset kits then check out my Ultimate Survival review & tutorials: https://goo.gl/WWEsZb

---------------------------------------------------------------------

► Twitch =   / themessycoder  
► Twitter =   / themessycoder  
► Facebook =   / themessycoder  
► Discord =   / discord  

► Unity3D asset store = http://bit.ly/themessystore


-------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------



Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we have recommended. While clicking these links won't cost you any money, they will help me fund my development projects while recommending great assets!