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

GUI font size relative to screen size

Discussion in 'Scripting' started by sam268, Oct 20, 2014.

  1. sam268

    sam268

    Joined:
    Apr 21, 2014
    Posts:
    149
    Alright, so I am working on android, meaning I have to make everything adjust to very different screen sizes. (tablet vs phone). I know how to do the buttons, boxes, etc... However, no matter what I try, I can never get the font sizes of the GUI to change dependeing on the screen size. For instance.

    Tablet:
    |------------------|
    | Load Game | = Big button, big centered text. Works
    |___________|

    -----------------------------------------------------------------------------------------


    Phone:
    |--------|
    | Loa..| = Small button, text is still big though, thus it is not centered and is cut off.
    |_____|



    So, How do I make the font size smaller depending on screen size, so that it will stay centered and the same size relative to the button/box?
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
  3. sam268

    sam268

    Joined:
    Apr 21, 2014
    Posts:
    149
    Ok, so this makes all my buttons and texts change size depending on the screen size.... And the font is tiny, even on a big screen, which makes it impossible to read. I don't really want to change all my GUI in the whole game, I just want to make the font change size...
     
  4. sam268

    sam268

    Joined:
    Apr 21, 2014
    Posts:
    149
    Ok, nevermind, found a solution. Thanks for the help though.