So I have text unity new ui object.
I want to enlarge this text’s recttransform vertically so it can show more texts inside.
How can I do it at in-game dynamically?
I googled and used,
sysText.rectTransform.offsetMin, offsetMax,
RectTransformExtensions.SetRightTopPosition(sysRect, new Vector2(0, -OneLineHeight * many));
but neither works.
this is what i do - since it found it the most solid on mobile - but there is some other ways of doing it as well.
RectTransform rt = this.GetComponent<RectTransform>();
rt.anchorMin = new Vector2( relativeX1, relativeY1 );
rt.anchorMax = new Vector2( relativeX2, relativeY2 );
rt.offsetMin = rt.offsetMax = Vector2.zero;
I never used unityUI, so was curious…
…is 2nd one: rt.anchorMax = new Vector2( relativeX2, relativeY2 );