Limit Max Width of a Layout Component in Unity

Original post of the problem: http://forum.unity3d.com/threads/limit-max-width-of-layout-component.316625/


A textbox with a child text component. The textbox width would increase with the length of the text up to this maximum value at which point the width would be fixed forcing the text to wrap to the next line now increasing the height of the button.

A common needed of UI. I was surprised that Unity didn’t have max width for their vertical layout component so far… But never mind, using combinations of vertical and horizontal layouts could achieve what we want.

Continue reading