Why is GUILayout.MinHeight applying a maximum height to my element?

See title.

Observe image.

GUILayout.MinHeight is applying a maximum height to my label. I need to have vertically-expanding labels, using Layout functions. What is broken, and how do I work around it?


Tried this and got the same, but I’m not sure that it is MaxHeight that gets set. Rather–I guess–Unity thinks MinHeight means clipping labels over the min height is okay when other elements don’t fit. Because removing MinHeight option works for me and the label is never clipped (and adding GUILayout.MaxHeight(500f) changes nothing). In other words, label’s default min height seems to be the full text height, while you allowed it to get clipped down to 16f.

I guess you should remove MinHeight; or if not, then calculate the text size with GUILayout.MinHeight(GUI.skin.label.CalcSize(new GUIContent("Hello Bye Sup")).y)


public Image YourImageOrRawimage;
YourImageOrRawimage .GetComponent<RectTransform>().sizeDelta = new Vector2( minWidth, minHeight);

Don't forget it >using UnityEngine.UI;