Author Topic: UILabel buffer text  (Read 3739 times)

huuloc

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
UILabel buffer text
« 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

The text is: "Change Text In Update" + Time.realtimeSinceStartup.ToString ()

Anyone can tell me, How can I improve it?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel buffer text
« Reply #1 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.