Search Unity

How to force an aspect ratio on final build?

Discussion in '2D' started by Auticus, Aug 21, 2019.

  1. Auticus

    Auticus

    Joined:
    Jul 18, 2013
    Posts:
    99
    I have a game I built that is built in a 9:16 mobile aspect ratio. In the editor it works fine:
    upload_2019-8-20_19-32-48.png

    When I try and build it and run it, it maxes out my screen and the borders you see here are gone, and the player ship can just move out past the boundaries.

    On a build how do you get it to enforce the 9:16 that the editor seems fine with enforcing? When I do a final build I want the same play area that the editor seems fine with allowing.
     
  2. Primoz56

    Primoz56

    Joined:
    May 9, 2018
    Posts:
    369
    i use a canvasscaler object with camera snap and a giant black box behind it for when the aspect ratio of the mobile is not the same as what you expect. you can test your ratio just by resizing the unity window, should always see the whole screen, with extra black borders on top/bottom or sides