Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: huuloc on January 04, 2016, 04:29:47 AM

Title: UILabel buffer text
Post by: huuloc on January 04, 2016, 04:29:47 AM
Hi there,

Currently, I found that  NGUI Label is very heavy when I changed the text of the Label frequently.

I think, NGUI change the text directly, instead of making a char-array buffer for this.

Here is the example between NGUI and TextMeshPro
(http://i.imgur.com/BeFwSnu.png)
The text is: "Change Text In Update" + Time.realtimeSinceStartup.ToString ()

Anyone can tell me, How can I improve it?
Title: Re: UILabel buffer text
Post by: ArenMook on January 05, 2016, 06:55:31 AM
Time.realTimeSinceStartup is a very expensive call. In any case you should always minimize the amount of stuff that changes on the screen. NGUI has built-in checks that prevent UI alteration if there are no changes. Setting the label's text actually checks if the text has changed before altering the draw calls. In your example realTimeSinceStartup differs every frame, so it always causes draw calls to be rebuilt which is not a fast operation.