Hello,
I am using UILabel with Overflow property set to 'ResizeHeight' as a Prefab. Every time I instantiate a new one label of this type I try to read the property height but its value is wrong (while the height shown in the editor is correct)
Here is the piece of code I use to get the Label's height:
UILabel textIng = Instantiate(textsLabel) as UILabel; // textsLabel is the prefab I use
textIng.text = "my dynamic text here sometimes it can be very long";
textIng.transform.parent = topAnchor; // topAnchor is the anchor where I attach the label
textIng
.transform.localScale = new Vector3
(1f, 1f, 1f
);textIng
.transform.localPosition = new Vector3
(25f, currentY,
0); // currentY is an incremental variable I use to display one label below another
Debug.Log(textIng.height); // this returns the wrong height value while in the editor I can see it correct
Any help would very appreciated
Thanks in advance