As a long time user of NGUI, I used the feature of auto-fitting text some times to allow my text to freely rescale and have any border of it readjust to the new size (think of growing text balloons). As is in UUI (or whatever we’re calling it), I haven’t figured out any way to do this other than attempting to calculate an optimal size for the text components.
Any suggestions? If needed I’ll provide a sample project to further explain what I mean.
I have seen the Best Fit, but it doesn’t resize the UI element, it rescales the font size to best fit the bounds of the element.
I have also tested Horizontal/Vertical Overflow, which allows the text to overflow, but does not resize the Rect Transform properties, which makes it impossible to have a sliced border image that resizes to always surround the text. Unless I’m missing something…
What I’m trying to achieve is a constant-sized font which always fits justly inside a background balloon. This balloon should resize according to the amount of text. The Overflow property allows the text UI element to be any size, but it doesn’t update the Rect Transform, which makes anchoring the balloon to the text element have no practical effect.
Here’s an example of what happens. The first image is the text overflowing, but no element resizing. The second image is how I expected it to work (text element resizes, allowing the anchoring to work properly). Never mind the element rendering order (which is another extremely poor implementation of the new UI system, I cannot arbitrarily choose an anchor, I must use the hierarchy system, which also decides the rendering order, but let’s leave that for another discussion).
That’s exactly what I wanted to avoid. The width depends not only on the length of the string, but the font size, for instance, which makes this calculation quite troublesome (not to mention other factors). This would make this system extremely easy to break.
Dam did you already check & played with the Content Fitter components?
they should make it (anyway i had some problems using them with auto layout. in your case i think they’ll work!
Thanks, krur. I was just navigating checking if I could help out anyone else and I found this thread (http://forum.unity3d.com/threads/input-filed-fit-to-content.281359/), which mentioned this component. I tested it and indeed it works for my case. Now to solve the render order…