GUIText, font size doesn't affect scale on OUYA?

SwiftIllusionSwiftIllusion Posts: 33Member
I use GUItext in my game, but when I send it to the OUYA none of the text is scaled?
Is this a limitation of OUYA, or Unity, or is there a setting besides 'font size' I need to change for this?

I'd really appreciate some help with this as it pretty much ruins my entire game not being able to use text as it's used for keeping score/time/etc.

Comments

  • DreamwriterDreamwriter Posts: 768Member
    Unfortunately, I can't help you directly, since I use NGUI, but keep in mind the OUYA default resolution is 1080p, unless your TV doesn't support 1080p signals at all, at which point it'll use 720p.  So any scaling would be done with that in mind.
  • SwiftIllusionSwiftIllusion Posts: 33Member
    Thanks for the tip at least :)
    Is there a way to force the 720p resolution?
    I heard it mentioned somewhere that someone changed their resolution to 720p and it helped framerate, my project doesn't need 1080p and it would be a nice time-saver if I didn't need to try and setup different font sizes when I'm able to get it working. And even if I did set it up on both I'd need to be able to test 720p for those that don't have 1080p.
  • DreamwriterDreamwriter Posts: 768Member
    edited May 2013

    Well, you can make Unity render at just one resolution, and automatically scale the entire screen to whatever resolution the device is using, using Screen.SetResolution.  That's the closest you can get (and yeah, doing that can really help framerate).  And since it automatically scales, you don't even need to use normal resolutions - you could set the resolution to lower than 720p and it'll still scale it to full screen, or halfway between 720p and 1080p if you wanted extra detail on 1080p TV's without the full framerate hit.

    Post edited by Dreamwriter on
  • SwiftIllusionSwiftIllusion Posts: 33Member
    Thanks again for the awesome tips.
    Would it at all be possible to request a prefab object to set the screen resolution?
    Or is there already a prefab elsewhere?
    At the moment it is looking like I'm going to end up having to try and use NGUI,
    though I fear how little I'll be able to do as a non-programmer using Playmaker
    and how hard it is going to be to change everything to it,
    but it's all I'll be able to do if no one is able to respond with a solution to this problem.
  • tgraupmanntgraupmann Posts: 2,869Administrator, Team OUYA
    Yeah it's a limitation of Unity 3.X and Android. It wasn't until Unity 4.X that they added dynamic font sizes for GUIText. I haven't actually seen it work. You basically need to make a font or skin for each font size that you want to use.
    ~Tim Graupmann
    OUYA Inc | Android Developer
    Skype: tgraupmann_prey

    http://github.com/ouya/docs
    http://github.com/ouya/ouya-sdk-examples

    Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]

    Use caution when setting [persistent wireless mode].
  • SwiftIllusionSwiftIllusion Posts: 33Member
    Awesome, thank you so much for that :), so just to clarify you're saying you would manually re-size the texture used for each font size you need?
  • tgraupmanntgraupmann Posts: 2,869Administrator, Team OUYA
    It's the same process for making any font in Unity. You import a TTF or open font and instead of setting the size to dynamic, you hardcode the size. You just end up with 1 file per font size. It's inefficient.

    NGUI is easier...
    ~Tim Graupmann
    OUYA Inc | Android Developer
    Skype: tgraupmann_prey

    http://github.com/ouya/docs
    http://github.com/ouya/ouya-sdk-examples

    Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]

    Use caution when setting [persistent wireless mode].
  • SwiftIllusionSwiftIllusion Posts: 33Member
    It might be easier for a programmer, but regrettably I'm not one, and I haven't found any Playmaker actions for NGUI which would help either. So that's the only solution available to me.
  • ClarkGameClarkGame Posts: 74Member
    Your issue is that Unity 3.5.7 does not support dynamic fonts for mobile. So you import all font static in Unity. Then you use a script like this:

    internal class UtilityFontCollection : MonoBehaviour
    {
        public Font font08;
        public Font font09;
        public Font font10;
        public Font font14;
        public Font font15;
        public Font font16;
        public Font font17;
        public Font font18;
        public Font font19;
        public Font font20;
        public Font font21;
        public Font font22;
        public Font font23;
        public Font font24;
        public Font font25;
        public Font font26;
        public Font font27;
        public Font font28;
        public Font font29;
        public Font font30;
        public Font font32;
        public Font font34;
        public Font font35;
        public Font font37;
        public Font font38;
        public Font font40;
        public Font font42;
        public Font font45;
        public Font font46;
        public Font font48;
        public Font font51;
        public Font font53;
        public Font font56;
        public Font font64;
        public Font font68;
        public Font font85;
       
       
        internal void setFonts(float screenW) {
           
            float pixel = screenW;
           
            if (pixel > 2400) {
                // standard 2560px
                Common.fontDouble = font46;
                Common.fontSingle = font51;
                Common.fontShort = font56;
                Common.fontScream = font85;
               
            } else if (pixel > 2000) {
                // iPad3 2048px
                Common.fontDouble = font37;
                Common.fontSingle = font40;
                Common.fontShort = font45;
                Common.fontScream = font68;
               
            } else if (pixel > 1800) {
                // standard FullHD 1920px
                Common.fontDouble = font34;
                Common.fontSingle = font38;
                Common.fontShort = font42;
                Common.fontScream = font64;
               
            } else if (pixel > 1500) {
                // standard 1600px
                Common.fontDouble = font29;
                Common.fontSingle = font32;
                Common.fontShort = font35;
                Common.fontScream = font53;
               
            } else if (pixel > 1400) {
                // standard 1440px
                Common.fontDouble = font26;
                Common.fontSingle = font28;
                Common.fontShort = font32;
                Common.fontScream = font48;
               
            } else if (pixel > 1300) {
                // standard AIR 11" 1366px
                Common.fontDouble = font24;
                Common.fontSingle = font27;
                Common.fontShort = font30;
                Common.fontScream = font45;
               
            } else if (pixel > 1200) {
                // standard HDReady 1280px
                Common.fontDouble = font23;
                Common.fontSingle = font25;
                Common.fontShort = font28;
                Common.fontScream = font42;
               
            } else if (pixel > 1100) {
                // iPhone5 1136px
                Common.fontDouble = font20;
                Common.fontSingle = font22;
                Common.fontShort = font25;
                Common.fontScream = font37;
               
            } else if (pixel > 1000) {
                // iPad2 Mini 1024px
                Common.fontDouble = font18;
                Common.fontSingle = font20;
                Common.fontShort = font22;
                Common.fontScream = font34;
               
            } else if (pixel > 900) {
                // iPhone4S 960px
                Common.fontDouble = font17;
                Common.fontSingle = font19;
                Common.fontShort = font21;
                Common.fontScream = font32;
               
            ...
               
            }
        }
    }

    The fonts I set in this way are for my 4 uses: DoubleLiner, SingleLiner, Short, Scream.
    I wrote them to a static class (Common.) whre I can access them from anywhere to put them into the GUI labels.

    Hope that helps.

    Matthias Titze
    CLARK

    by
    GoldenTricycle


    Developer for CLARK / GoldenTricycle
    Developer of OuyaInput Framework >> GIT


  • ClarkGameClarkGame Posts: 74Member
    By the way: The public fields appear in the inspector. There you drop your static imported fonts for every size you need.
    Matthias Titze
    CLARK

    by
    GoldenTricycle


    Developer for CLARK / GoldenTricycle
    Developer of OuyaInput Framework >> GIT


  • tgraupmanntgraupmann Posts: 2,869Administrator, Team OUYA
    Cool. Yeah Unity 4.X added dynamic fonts; one reason to upgrade.
    ~Tim Graupmann
    OUYA Inc | Android Developer
    Skype: tgraupmann_prey

    http://github.com/ouya/docs
    http://github.com/ouya/ouya-sdk-examples

    Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]

    Use caution when setting [persistent wireless mode].
Sign In or Register to comment.