Mobile Game Screen Problem

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Awsomewolf2

So I am new to making games and code and therefore I do not really know how to make the game screen fit for every size of phones and tablets. You see the error is that when I open up my game every scene works perfectly but it stays small and has black screen surrounding it. I need to know how to fix this. Here are my settings: Width: 720, Height: 1280, Orientation: Portrait, Mode: 2d, Aspect: keep or keep-width
The images below help explain

Image links:

You have a number of options available here, but you’ll first need to decide how your game should react to screens that have differing resolutions or differing aspect ratios than your original design.

For example, in your linked screenshots, the device running your game has an aspect ratio that doesn’t match your original game design (the device is comparatively “taller” - hence the black bars top and bottom).

In that case, you could (for example):

  • Maintain your game’s existing aspect ratio and not clip anything, but have the black bars (as shown in your image)
  • Scale the game up until the entire screen is filled (in both axis) without changing the aspect ratio. While this won’t stretch/squash anything graphically, it will make some content not visible (the left/right edges in the case of your screen shot).
  • Stretch the game to fit the new device aspect ratio. This will keep all of your original content visible, but will change the height/width of your graphics as necessary to make it fit the device.

With varying device aspect ratios and resolutions, all of the above are somewhat of a compromise, but really are the best you can do.

So, first, figure out how it should work and then someone can probably provide you with details on how to set that specific scenario up…

jgodfrey | 2023-06-29 20:46

I think that the width itself is working great and if I could only adjust the height to fit the screens maybe that would work except by using an aspect instead of individually resizing the screens.

Awsomewolf2 | 2023-06-29 20:59