[SOLVED] Scale game to current screen size

Hello everyone,

I was recently trying my game in mobile, and was left wondering how to use the game in portrait orientation. This is how it (sort of) currently looks.

Is there a way to scale the game to meet screen res?

EDIT - Guys this is quite important, so I’d really appreciate some help.

If you are talking about scaling the UI to automatically fit smaller displays, study how the scale blend factor works on screens.

You should be able to use that to make your interface automatically scale.

1 Like


That’ll only work for the 2D screens in the game. However, I need the models also to not ‘go out’ of the screen. Is that possible?

Look into these:

  1. https://api.playcanvas.com/classes/Engine.CameraComponent.html#horizontalFov
  2. https://api.playcanvas.com/classes/Engine.CameraComponent.html#aspectRatio
  3. https://api.playcanvas.com/classes/Engine.GraphicsDevice.html#width
  4. https://api.playcanvas.com/classes/Engine.GraphicsDevice.html#height

These will give you enough information of your screen size, so you can position entities appropriately, to fit into viewport.


Thanks @moka