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. Dismiss Notice

Question Game view aspect ratio not the same as in build?

Discussion in 'Editor & General Support' started by alexxUID, Apr 5, 2023.

  1. alexxUID

    alexxUID

    Joined:
    Jan 14, 2020
    Posts:
    48
    Hi,

    in my game view in the editor I can set my aspect to 16:9. When I now change the width height of the game view, my UI and all changes to display a 16:9 view of the game. The UI scales just fine with the changes and letterboxes are visible to block the parts outside the 16:9 view.
    When I build the game and now change the size of the window my UI Elements behave completely different and don't scale the same anymore. There are no letterboxes either.

    Is there a way to have the build behave the same as the game view in the editor.

    Thanks

    Alex
     
  2. OBiwer

    OBiwer

    Joined:
    Aug 2, 2022
    Posts:
    61
    1. depending on which UI solution you're using:
    - uGUI -> go to the "Canvas", there should be a Canvas Scaler, Set to "Scale With Screen Size" give it a 16:9 Reference Resolution
    - UIToolkit -> go to the UIToolkit Panel Settings, Adjust the Scale mode as described for the Canvas Scaler above.


    In earlier unity versions you could selected "supported aspect ratios" in the Project Settings > Player > Resolution and Presentation
     
  3. alexxUID

    alexxUID

    Joined:
    Jan 14, 2020
    Posts:
    48
    Thanks, those settings are already done.
    The problem seems to be that the editor allows you to restrict the game view to 16:9 whereas the build does not allow that (any more?) and runs in "free aspect". Hence the different behavior.

    As I read in another thread unity does not help with a fixed aspect ratio and letterboxing anymore in the build and I have to care about it myself.