Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Santos on January 19, 2015, 05:22:04 PM
-
I'm trying to find out the width of a text in the screen so that I can have a sprite that is always aligned to the text when it changes.
After some research I discovered the NGUIText.CalculatePrintedSize(). However, if I got it right, for it to work first I would need to set it's static bitmapFont property. The problem is that the UILabel in question does uses a TrueType font instead of a Bitmap one.
How can I find out the text's width in this case?
Thanks,
-
First call label.UpdateNGUIText(), then NGUIText.CalculatePrintedSize. There is no need to set the bitmapFont yourself.
-
Works like a charm.
Thanks,