Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

uGUI, Scale the buttons with the resolution?

Discussion in 'UGUI & TextMesh Pro' started by Tiles, Aug 21, 2014.

  1. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,481
    Let's say i have different resolutions. How do i scale the buttons to fit the different resolutions? The example project just shows an example where the buttons keeps their initial size instead of scaling with the resolution. And then the buttons can overlap, or with bigger resolutions, become too small to be readable.
     

    Attached Files:

  2. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,481
    Found a solution. I need a orthographic GUI cam. Then i set the render mode of the Canvas to world space. Needs a bit fiddling until everything is displayed where it is needed. But now the GUI scales with the resolution.

    Works just for same ratio though. When you switch from 4:3 to 16:9 then you need another GUI layout.
     
  3. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    You may consider to use the Reference Resolution component. It needs to be added to the canvas.
     
  4. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,481
    Thanks Dantus,

    Do you know where it resides? The UI menu entries doesn't show this component.
     

    Attached Files:

  5. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    I can't check your image yet, but I see the thumbnail. I believe you are looking for Component -> Layout.
     
    Tim-C and Tiles like this.
  6. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,481
    Ah, there it hides. Cool. Many thanks :)
     
  7. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    It is in the scaler currently,