Author Topic: Font not showing *only* in iOS build  (Read 3846 times)

deathmtn

  • Guest
Font not showing *only* in iOS build
« on: October 02, 2012, 05:10:44 PM »
I've been working with font prefabs made in Font Maker, and they have been fine when I play the game in the Unity editor using the iOS configuration.

However, when I build and deploy to an iPad, there is one font that won't show up. If I change the UILabel in question to use a different font, that displays just fine.

I've tried deleting the font prefab and recreating it to no avail. All of my atlases are under 1024x1024.

Any ideas about what else can I try and look at to debug this?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Font not showing *only* in iOS build
« Reply #1 on: October 02, 2012, 05:21:19 PM »
Look inside the font's TXT file. Did it export correctly? What is the font's size?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Font not showing *only* in iOS build
« Reply #2 on: October 02, 2012, 05:22:07 PM »
Oh yeah, and the more obvious question: is your font actually getting included in the build? Unless it's referenced, it will get stripped out on build.

deathmtn

  • Guest
Re: Font not showing *only* in iOS build
« Reply #3 on: October 02, 2012, 05:57:52 PM »
The actual font's size is 24, but the Font Size as reported in the prefab is 27, which I'm guessing is pixel size? That's the size it makes GameObjects when I hit "Make Pixel Perfect."

The TXT file seems to be fine, in that it looks like the other font txt files. Is there anything in particular I should be looking for?

The font is referenced by a UILabel that is present in the hierarchy at build time. Does anyone know of a way I can look through the build to check the included resources? Unity seems to just pack everything into several opaque DLLs.

Thanks for your response, ArenMook!

deathmtn

  • Guest
Re: Font not showing *only* in iOS build
« Reply #4 on: October 02, 2012, 06:15:53 PM »
I tried deleting the prefab, text file, and the png just now and reexporting the font from Glyph Designer, then recreating the font in Font Maker. Same results. Gonna go scratch my head some more.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Font not showing *only* in iOS build
« Reply #5 on: October 02, 2012, 07:39:54 PM »
Are you sure it's not showing up? Maybe it's hidden by something (like the button's background)? If it's using a different atlas, then you need to bring it forward by adjusting the transform's Z (negative).

deathmtn

  • Guest
Re: Font not showing *only* in iOS build
« Reply #6 on: October 02, 2012, 09:12:17 PM »
That was it! Thanks so much! I was aware of that characteristic of UIPanel, but I had forgotten that I had moved my fonts into another atlas.

Incidentally, any idea why when played in the editor, it would draw that font on top of the background, but not on the device?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Font not showing *only* in iOS build
« Reply #7 on: October 02, 2012, 10:28:16 PM »
It's all random when the Z is the same. It's up to Unity to determine what's drawn first, which differs from platform to platform.

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: Font not showing *only* in iOS build
« Reply #8 on: October 02, 2012, 10:48:05 PM »
I am not sure what Unity does, but when Z objects are the same, the drawing order seems to be platform specific rather being random.

I had a button that once pressed, spawned several other buttons which popped out from behind the main button, but on the Mac, iPhone etc they always appeared on top of the main button. The issue being both sprites had the same Z.

However the issue seems to be made more complex when you have multiple Atlases. You're probably (and quite rightly) using an Atlas for your font and another for your menu gfx. Problem is, staggering two buttons over each other will result in the text appearing over both buttons, even if the Z position and DrawingOrder is correct.
All it takes for example is one label to be really far away from your camera to make all your text vanish behind your gfx. Which can and often will be ok in Windows but not on iOS or vice versa.
Unless you use a separate UIPanel to make an extra DrawCall.

For now, my advice is that you double check your menus on your target platform every now and again to make sure you don't have any weird vanishing graphics issues. If like me you tend to copy and paste your widgets around, it can be a pain to sort out all your Z issues later.
« Last Edit: October 02, 2012, 10:50:00 PM by ENAY »