Search Unity

Unity UI Scaling Entire Panel to Fit Screen

Discussion in 'UGUI & TextMesh Pro' started by MrHappyKiller, Aug 8, 2017.

  1. MrHappyKiller

    MrHappyKiller

    Joined:
    Feb 8, 2016
    Posts:
    29
    I've been having quite a bit of trouble making my panel always scale the the screen size. I want my panel to fill the entire screen no matter the aspect ratio. I've been using Canvas scaler to try and do this, but it doesn't want to budge. Currently I have Canvas scaler set to Match Width Or Height with the match set to 0.5. My panel anchors are set to the corners of the parent canvas. But it doesn't scale right. :/
     
  2. Senshi

    Senshi

    Joined:
    Oct 3, 2010
    Posts:
    557
    In addition to placing your anchors at the corners, make sure to zero out any offset values (left, right, top, bottom) that the panel might have.
     
    SimonDarksideJ likes this.
  3. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,689
    What @Senshi said.

    Try going through the UI tutorials on the Unity Learn pages, they walk you through setting up anchors properly.

    Also, the PANEL component is (by default) scaled to use the entire canvas.

    *Note, if you hold the Alt key when selecting an Anchor default, it will automatically reset the dimensions of the RectTransform to match the new anchor values.