Author Topic: Debugging Fonts cache problems and Viewing Font texture Memory at runtime  (Read 4067 times)

Tiktaalik

  • Newbie
  • *
  • Thank You
  • -Given: 7
  • -Receive: 0
  • Posts: 39
    • View Profile
I'm currently tracking down a pause in our game that I believe is due to Font.CacheFontForText. To solve this problem I need to get a better feel for how our use of fonts in screens at that moment is affecting the game's performance.

I want to test whether disabling certain NGUI UILabel options (ie. shrink text, shadow) will have enough of an impact to solve the issue or whether it's irrelevant.

Is there a way in Unity to see a snapshot at runtime of what memory Unity has allocated for Fonts in particular? What would be the best way to approach debugging this problem?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Dynamic fonts are pretty terrible in the current version of Unity, and I don't advise using them. There are too many issues with them that are a result of bugs or limitations in Unity that I have no control over. And yes, their performance is quite a bit slower than NGUI's fonts as well. I'm not aware of any way to see what memory Unity is using for fonts.

Your best bet is to disable "keep crisp" option on all labels, and to use a consistent font size on as many of them as you can. Meaning pick some sizes that you will be using -- size 20, 24 and 32 for example, and stick to those.