Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity 3-b6 iPhone Fonts problem ?

Discussion in 'Editor & General Support' started by impla007, Aug 22, 2010.

  1. impla007

    impla007

    Joined:
    Jan 30, 2010
    Posts:
    57
    is it a U3 B6 bug or something I missed ?

    I have a simple GUIText and I got this error message looping on the xcode console when running the app.

    Code (csharp):
    1.  
    2. Font size and style overrides are only supported for dynamic fonts.
    3.  
    4. (Filename: /Applications/buildAgent/work/ba2af227d3fa2d82/Projects/../Runtime/Filters/Misc/Font.cpp Line: 116)
    5.  
    6. Font size and style overrides are only supported for dynamic fonts.
    7.  
    8. (Filename: /Applications/buildAgent/work/ba2af227d3fa2d82/Projects/../Runtime/Filters/Misc/Font.cpp Line: 219)


    I have tried with all king of fonts but I still have this message looping on the console.

    A bug or is it coming from me ?
     
  2. jkreijkamp

    jkreijkamp

    Joined:
    Dec 5, 2007
    Posts:
    129
    Haven't used GUI fonts yet in U3 but I think the issue is that you use bitmapped fonts and try to size them, which you can't. You need to use the new options to directly render ttf fonts to get the option to size fonts. Don't know if you can use ttf fonts on iOS and if so how well it would perform, but just try and see.
     
  3. impla007

    impla007

    Joined:
    Jan 30, 2010
    Posts:
    57
    Seems that U3 B6 does not allow to import dynamic fonts.
    Here is the message I got from Unity trying to import .ttf fonts.

    BUT Unity still generate xcode code that overrides styles/size and so it turns xcode sending the error messages.

    If you stay with the default font Arial and change nothing to the size, it's fine... but small.....
     
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    at least previous versions only pretended to not support it.
    the main reason you shouldn't use them is that you have no way getting at the bold and italic versions, they only work when you select "dynamic" instead of unicode which is not available outside the desktop
     
  5. groovfruit

    groovfruit

    Joined:
    Apr 26, 2010
    Posts:
    257
    I've been having the same issues with fonts. I imported 2 ttf fonts, and everything was fine.. no warnings or anything... and then suddenly out of nowhere i do a build and my console is filled with the above warning.

    So does this mean we can ONLY use the Arial default font? If so, that's really limiting lolol.... i really wanted to use GUIText etc, but if it only allows arial i'm kind of screwed as it doesn't fit with the style. And can't change the size? That's weird.
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    No you can use other fonts too, thats no problem.
     
  7. vegashacker

    vegashacker

    Joined:
    Sep 4, 2010
    Posts:
    18
  8. samap

    samap

    Joined:
    Dec 21, 2010
    Posts:
    1
    Just wanted to add that I was also getting this issue. In addition to the message "Font size and style overrides are only supported for dynamic fonts." spamming in the xcode console window, it was also causing slow performance for my simple app. Eventually (a minute or two of use), my app would crash out with the final error message "exceeded 500 log message per second limit".

    My test app is pretty simple, but it did have 3 GuiText objects for which I had increased the font size. The errors and crashes went away when I changed over to using default, script defined Gui.Label() objects.

    I haven't tried adjusting the size with these to see if the error comes back. I'm just glad to be rid of it for now!

    I'm using Unity 3.1.0f4 with an iPhone 3G.
     
  9. francksitbon

    francksitbon

    Joined:
    Jan 22, 2010
    Posts:
    268
    same problem for me, lots of warnings
     
  10. schwertfisch

    schwertfisch

    Joined:
    Sep 7, 2010
    Posts:
    126
    I get this warning too. Haven't figured out how to solve it yet.
     
  11. wesllg

    wesllg

    Joined:
    Jan 8, 2011
    Posts:
    18
    Just to put my hand up here, I am also having this issue. Only just started deploying our title to iPhone, but it eventually falls over due to this.
     
  12. Derell Nar

    Derell Nar

    Joined:
    Jan 25, 2011
    Posts:
    10
    First of all, Dynamic fonts are only supported on PC and MAC platforms.
    So in order to get fonts to work on Mobile devices you must use Unicode for the Character set.

    This is what you need to do.
    - Import a TTF font file in Unity.
    - Set the Character Set to Unicode.
    - All other information is up to you, size, anti-aliasing, etc
    - If you use the font in a GUIText, make sure that the "Font Size" is set to "0" and "Font Style" is set to "Normal".

    If one of your GUIText is set with different values for those two fields, you will get the error message!

    I hope this helped.
     
  13. disband85

    disband85

    Joined:
    Dec 7, 2010
    Posts:
    83
    I have the same problem where on Mac and iphone, the font is really tiny and in the Unity Editor on Mac I get spammed with 'Font size and style overrides...' message.

    My font is a TTF and I have set the 'Character Set' to Unicode. This made my font a little bigger but I still get spammed with that warning in the console. I'm using the font in a GUIStyle. These are the properties of the GUIStyle I'm using:

    Normal -> Text Color: set my color here
    Font: Dragged my imported TTF here
    Font Size: 28
    Alignment: Upper Right

    Everything else is default. Derell Nar said the following:

    - If you use the font in a GUIText, make sure that the "Font Size" is set to "0" and "Font Style" is set to "Normal".

    What about if I'm using the font in a GUIStyle? If I set the font size to '0', how do I actually set the size of it?
     
  14. disband85

    disband85

    Joined:
    Dec 7, 2010
    Posts:
    83
    Ok I changed font size in the GUIStyle to 0 and now the message no longer appears. But the font size is still too small, how do I increase it without changing 'font size' in the GUIStyle? Here's my label:

    Code (csharp):
    1.  
    2. GUI.Label(new Rect(5, 83, 60, 80), score.ToString(), fontStyle);
    3.  
    If I increase the size of the Rect, it just makes the label bigger but doesn't increase the size of the font.
     
  15. disband85

    disband85

    Joined:
    Dec 7, 2010
    Posts:
    83
    I just found out you can change the size of the font by changing 'Font Size' in the TTF properties (where you change 'character' to unicode). I have several different GUIStyle's using this TTF font, specifically for the purpose of different font sizes. So it looks like i have to import the TTF multiple times, one for each size that I want.
     
  16. schwertfisch

    schwertfisch

    Joined:
    Sep 7, 2010
    Posts:
    126
    Solution found indeed- thanks Darell!
     
  17. Derell Nar

    Derell Nar

    Joined:
    Jan 25, 2011
    Posts:
    10
    Yeah the only real way to change your font size is to do in the TTF in Unity.
    If you need different font sizes because of different Resolutions, you'll have to duplicate the TTF in Unity and give them different font sizes.
    In code you can choose which font to choose based on resolution...

    Pseudo code example:

    // Fonts assigned in Inspector
    public GUIStyle myStyle;
    public Font fontRes1;
    public Font fontRes2;
    public Font fontRes3;

    if (Resolution1)
    myStyle.normal.font = fontRes1;​
    else if (Resolution2)
    myStyle.normal.font = fontRes2;​
    else if (Resolution3)
    myStyle.normal.font = fontRes3;​
     
    Last edited: Feb 11, 2011
  18. hieu.ivieoh

    hieu.ivieoh

    Joined:
    Dec 16, 2010
    Posts:
    12
    Solved!!! Thanks Derell so much.
     
  19. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    Setting font size to zero fixed this for me. I thought if I made the size the same size as the imported font that'd be fine, but that's not the case. Thanks Derell for the fix.
     
  20. sridhar21s

    sridhar21s

    Joined:
    Jul 13, 2011
    Posts:
    5
    That worked for me. Thanks a lot.
    For the benefit of others, here's how I got into this problem in the first place. I developed a game using Unity 3.3 for iOS. I upgraded to Unity 3.4 and continued working on my game using Unity 3.4. I believe there are some serious bugs/issues with 3.4 due to which my game performance degraded and started causing memory warnings. So I downgraded to Unity 3.3 and opened the game using Unity 3.3 and started seeing all sorts of errors and warnings (like this font issue being discussed in this thread). I had to manually fix the project to behave well with Unity 3.3. I've learned my lesson. I should have backed up my project before opening it with the newer version of Unity.
     
  21. sridhar21s

    sridhar21s

    Joined:
    Jul 13, 2011
    Posts:
    5
    That worked for me. Thanks a lot.
    For the benefit of others, here's how I got into this problem in the first place. I developed a game using Unity 3.3 for iOS. I upgraded to Unity 3.4 and continued working on my game using Unity 3.4. I believe there are some serious bugs/issues with 3.4 due to which my game performance degraded and started causing memory warnings. So I downgraded to Unity 3.3 and opened the game using Unity 3.3 and started seeing all sorts of errors and warnings (like this font issue being discussed in this thread). I had to manually fix the project to behave well with Unity 3.3. I've learned my lesson. I should have backed up my project before opening it with the newer version of Unity.
     
  22. Finjitzu

    Finjitzu

    Joined:
    Sep 8, 2011
    Posts:
    160
    This worked for me too. I had to delete the fonts and re-import them though.