1
NGUI 3 Support / PrintedSize returns wrong size
« on: December 18, 2014, 05:26:43 AM »
Hi
I am trying to achieve a chat list with bubbles around the text, and to not just have the bubbles fit the text tightly I am using printedSize from the label. However it seems to return wrong values!
this is my code
// Message placed left
bubbleSprite.width = (int)messageLabel.printedSize.x + Mathf.Abs(bubbleSprite.leftAnchor.absolute) + 50;
I have tried to setup a picture which should illustrate the problem. The blue area is the actual size of the label rect (828), the green indicates what the value of printedSize should be (approx. 794) and the red illustrates the size returned from printedSize (638)
Is there anything I am doing wrong or a call I need to make before retrieving printedSize? (tried messageLabel.UpdateNGUIText(); but no change)
I am trying to achieve a chat list with bubbles around the text, and to not just have the bubbles fit the text tightly I am using printedSize from the label. However it seems to return wrong values!
this is my code
// Message placed left
bubbleSprite.width = (int)messageLabel.printedSize.x + Mathf.Abs(bubbleSprite.leftAnchor.absolute) + 50;
I have tried to setup a picture which should illustrate the problem. The blue area is the actual size of the label rect (828), the green indicates what the value of printedSize should be (approx. 794) and the red illustrates the size returned from printedSize (638)
Is there anything I am doing wrong or a call I need to make before retrieving printedSize? (tried messageLabel.UpdateNGUIText(); but no change)