Search Unity

Font | Rescale it for Screen

Discussion in 'Scripting' started by TechnoObi, Sep 1, 2014.

  1. TechnoObi

    TechnoObi

    Joined:
    Nov 30, 2013
    Posts:
    82
    I have a litte question. At the end of my game, I want to show "Current Score: " + score + "\nHigh Score: " + highscore . How can I set this to a font.size, which auto-resizes for the screen resolution and then center it, with the current font.size. How can I do that?
     
  2. laurelhach

    laurelhach

    Joined:
    Dec 1, 2013
    Posts:
    229
    If you use GUILayout you can automatically center your GUIs (button, label, box, etc.).
    Use BeginHorizontal() and BeginVertical() to center your text in the middle of the screen with FlexibleSpace().

    To have your fonts and Rect always updated look for Matrix or a script called GUIScaler.
    That will update your GUI depending of the screen your app is running on.

    Hope that helps a bit.
     
  3. TechnoObi

    TechnoObi

    Joined:
    Nov 30, 2013
    Posts:
    82
    Do you know a tutorial for that on YT?
     
  4. laurelhach

    laurelhach

    Joined:
    Dec 1, 2013
    Posts:
    229