Hi, can anyone help me with how to remove the aspect ratio ON MOBILE without stretching the sprites in my game?
I already set the properties of game resolution size to
“No changes to the game sizes”
and I already turned of the aspect ratio using the event:
Activate fullscreen: Yes, Keep aspect ratio: no
Thanks in advance
You’re doing the opposite of what you’re looking for.
No changes to game size means it’s going to absolutely keep the native size of the game and just force scaling, regardless of the actual resolution. This basically force-keeps the aspect ratio period.
Your only real option for what you’re looking for is to have it adjust the game size (You’ll need to choose one of the other options besides no changes to game size, and check the box below).
This will enlarge your game’s native resolution depending on the device, without resizing your assets. This means that if your game is 800x600 normally, and the device resolution is 1920x1080, your game will stretch the viewable area to fill in the extra space.
Unless you have a huge display, this will mean your assets WILL appear smaller, even though more information is being displayed. They will still be at their original resolution and not be stretched or distorted, though.
Depending on your type of game you can compensate for the resolution changing on the device by adjusting the zoom level in your game. Typically you’d have a “baseline” resolution that you developed against like “800x600” and the zoom level for that would be 1:1. So in your game logic (for every scene, so maybe put this in an external event?) you’d need to adjust your your zoom based on the native resolution… which I think is ScreenWidth() and ScreenHeight() as opposed to SceneWindowWidth() and SceneWindoHeight()… um double check that I’m not sure. But let’s say the native resolution is “1920x1080” like SS used above.
The point is you then need to decide if you want to have extra visibility in your game on the top/bottom, or the sides.
If you want top/bottom, then determine your zoom ratio based on widths: 1920/800 => 2.4
If you want sides, then determine your zoom ratio based on the heights: 1080/600 => 1.8
So you’ll get about the same looking game but with some extra space. You’ll need to make your UI elements adjust accordingly (See: Anchor behavior). Also, it’s very possible that your game will run slower in higher resolutions because it’s now rendering more pixels, whereas before it was rendering less pixels and upscaling natively which is computationally free from the app’s perspective.
2 Likes