How to change the screen size of WebGL

When I created my game in Unity, I chose the resolution of 1080 * 1920. It looks like this
7860244--997987--upload_2022-2-1_21-20-55.png

When I build the file of WebGL, I also changed the resolution size in player settings. But when it comes to web, the game became something like this:
7860244--997990--upload_2022-2-1_21-22-21.png

Could anyone tell me what to do to make the screen size on web be exactly like what I made in Unity?

Add a aspect ratio fitter component to your UI.
And if you can't resize the window, you can change the canvas size in the player settings.

7860430--998044--aspectratiofitter.jpg

Thanks! I tried, but it didn’t work

In case you haven't found an answer to this, you need to go to Edit > Project Settings > On the WebGL settings, change the default canvas width and height based on your ratio/screen size:

4 Likes

I have a similar issue. When I build the game it comes out super zoomed in. Not sure how to fix this, any suggestions?

1 Like

Change the Canvas Size to 1920x 1080 and use these modes Default one, To reflect it Delete the Browser Histroy and then try again using default. Browser catche save the resolutions.