Set scale for build window (SOLVED)

Hi, when i try to build the mobile template in my laptop the result window have wrong aspect ratio because of not much space is there for window, so it decided to mess up ratio and change the height of window, so the result window is not that accurate as you want to check.
is there a way to scale down the build window so it can fit the screen and keep it’s origin aspect ratio (like in AVD there is a scale parameter)? or is there any other workaround with this issue?

as you can see result window doesn’t have it’s original aspect ratio

1 Like

There’s not much you can do to keep the aspect ratio of the window. It’s up to the OS and the user. You can try to force an aspect ratio on resize using DefOS, but that’s not the proper way to solve this.

Ideally, you should just make your game responsive (so that it works on almost any aspect ratio). Nobody likes a stretched game just because they have a taller phone.

Look into setting up your projection in your render script.

3 Likes

You can do this in several ways:

  1. Make a copy and modify your renderscript. The original is in /builtins/render/default.render_script. Change from stretch_projection() to fixed_fit_projection().
  2. Use a camera extension from the Asset Portal. There’s both RenderCam and Defold-Orthographic
4 Likes

thanks, i used fixed_fit_projection and now i can test my game properly

2 Likes

This worked !. In the initialiser of default.render_script :
self.projection_fn = fixed_fit_projection

You can also change this by posting a message to the default render script: