How do I keep everything inside of the screen on a laptop?

So everything works fine and dandy on my desktop PC with 1920x1080. But when I try on a MacBook which is 2560x1600 or 16:10 the game gets cut off on the left and right side. The images in the game are 16:9 which fill up the whole scene and are essiential to play the game. How do I make it so its always 16:9 no matter what resolution the player picks?

For example on a 16:10 screen I would not care if there were black bars on the top and bottom of the screen, as long as all of the image in game is visible. Is there a setting in the player/build settings that can help me achieve this? Even if I allow only 16:9 and start the build the only available resolution on the mac is 1280x800, which is not even 16:9.

I hope you understand my problem. Thank you for your help.

Unity sets the aspect ratio of the camera to match your screen aspect ratio, but you can change it on runtime using: Unity - Scripting API: Camera.aspect

If you set the aspect ratio to a fixed value, you’ll see the same stuff in any screen you play, but the image will be stretched to fit the whole screen. If you want everything with the correct proportions you should change the “viewport” (as shown in the inspector) too using: Unity - Scripting API: Camera.rect

This will result in the sides of the screen not being used by the camera. If you do all this with a black screen you’ll end up with black bars at the sides like you wanted.

Another solution could be to set the aspect ratio, then render the main camera to a RenderTexture, and then using that render texture in a UI RawImage centered, with a AspectRatio constraint. This one can be setup easier in the editor, but it has some unnecessary overhead.

You should never make your game with the intention of a single aspect ratio or resolution, rather you should adjust your game to the player’s system. You can change the aspect ratio of the camera with the Viewport Rectangle property. Unity - Scripting API: Camera.rect