Centering aspect ratios in fullscreen


The game I am making uses a 1:1 aspect ratio. This works fine, however, when I go into fullscreen, the entire screen is pushed all the way to the left as you can see in the picture. This is just annoying to look at and I’d much rather have it in the center.

However, I would like to retain the aspect ratio as there are some parts of the game that also need to work with the square screen. Is there a way to just center the screen, so that the picture would look the same, except the game is in the center of the screen? If not or if it is really hard and innefficient, I’ll probably just make the screen fit whatever aspect ratio people play with and then add black bars on the GUI.

Well, it’s completely unclear what we’re actually looking at and how the graphics are produced at the moment. Is this just UI? Do you actually use a camera to render this? How did you actually ensure this aspect ratio? When you use a camera, you can simply restrict the rendering area to whatever screen region you want. There you can also fix varying aspect ratios. Of course the remaining area would not be rendered at all and could cause visual artifacts, depending on the target platform. So when using a camera to render your game, it’s generally better to have two cameras. One that renders / clears the background and one that is restricted to the screen center and actually renders your game content.

If this is actually just UI stuff it gets even more diffuse since there are countless of different ways how things can get arranged on the screen. So without further details on what we’re currently looking at this can not really be answered.