I have a bunch of objects which are generated in specific coordinates, let's say in a range of -5 to +5 on the X axis. I came up with these numbers because of camera size I have in Unity editor.

Example of game scene

What if I run my game on few random devices with different aspect ratios and resolutions? Will Unity adjust my game automatically so everything fits perfectly, or should I do it manually somehow? And if so, how?


2 Answers 2


This depends on how you've authored the objects.

  • 3D objects and 2D sprites positioned in your scene's worldspace will not move, scale or change their worldspace transformations no matter what happens to the display screen/window.

    • BUT: These objects are viewed through a Camera, and the camera's view is mapped to the screen. That mapping will change as the screen/window size changes.

      By default, Unity will keep the camera's vertical FoV or orthographic height the same, meaning that you'll see the same portion of your game world from the top to bottom of the screen. So if your objects were 60 pixels tall on a screen 1080 pixels in height, they'll be 40 pixels tall when displayed on a 720-pixel-high screen. The objects didn't move or shrink in your scene, so all your gameplay metrics and physics will work identically: they're just being displayed on fewer pixels.

      The width of the camera's view is, by default, allowed to grow or shrink to match the aspect ratio of the screen. So a player on a wider screen will see more of your scene to the left and right. If you haven't placed any objects there, they'll see blank space, because Unity doesn't know what you might want to put there instead - you'll have to tell it.

  • UI objects inside a Canvas element that's set to Screenspace - Camera or Screenspace - Overlay will be repositioned / sized according to their anchors when the dimensions of the containing canvas's viewport change.

    This lets you, say, make a UI button that's always in the bottom-right corner, no matter how tall or wide the window/screen is.

    The canvas and UI components expose a number of controls for you to decide exactly how you want this scaling to happen - whether you want to preserve sizes proportional to the width or height, or preserve the native pixel size of the elements, etc.

If you like the scaling behaviour described above, you're done. If not, then you'll need to define what "proper" scaling behaviour is for your game. Some examples:


It will adjust everything automatically for different resolutions if the aspect ratio is the same. If the aspect ratio is different, everything will still be scaled automatically, but you might see a little bit more or less of the game at the edges of the screen.

To see this for yourself, you can try resizing the game view window in the Unity editor and setting different aspect ratios in the game view control bar to see how your game behaves.

If you want to enforce a specific aspect ratio, this post illustrates the problem and also has potential solutions, such as enforcing a specific aspect ratio in the project settings, or adding a script to resize the camera viewport to fit that aspect ratio with a pillarbox or letterbox effect.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .