Author Topic: Font indirection  (Read 1043 times)


  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 80
    • View Profile
Font indirection
« on: March 04, 2014, 05:18:33 AM »

This is a suggestion I think may benefit lots of people. I'd like to treat fonts with some indirection, that is in my UI I have hundreds of labels and the all reference their fonts explicitly. If I want to change the font every where then it's very time consuming. (I'm currently writing scripts that do something like foreach (label in scene) {if label.font==fontX then label.font=fontY})

A better system would be to use a font reference (similar to an atlas reference), this way I can setup my UI and using something like "HeaderStyleFont" which points to an actual font. Should I then want to globally change the font I need only change the reference font instead of the every label going.

If this is already possibly within NGUI then I like to know how!



  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Font indirection
« Reply #1 on: March 05, 2014, 05:58:28 AM »
Look into the "Reference font" feature in NGUI. This is exactly what it's designed to do. It's exactly the same as reference atlases.

1. Create a game object.
2. Add UIFont to it, set it to "Reference", make it point to an actual font.
3. Save as a prefab.
4. Use this prefab on all of your labels.