[SOLVED] Is it possible to change the size of the canvas at runtime?

Hi,

In the settings, we can configure the width and height of the canvas. Here the settings in the JSON format when we export a project:

image

Is this possible to change this value in runtime (without page refresh) and refresh the visual to adapt to that new resolution?

Thank you

1 Like

Hi @Mystik,

Yes that’s possible. Check the following method, available in the pc.Application class:

https://developer.playcanvas.com/en/api/pc.Application.html#setCanvasResolution

1 Like

Thank you for your answer. This is marked as solved.

1 Like