Search Unity

Question How to change the screen size of WebGL

Discussion in 'Web' started by unity_9031566D65309E6FC641, Feb 2, 2022.

  1. unity_9031566D65309E6FC641

    unity_9031566D65309E6FC641

    Joined:
    Jan 31, 2022
    Posts:
    2
    When I created my game in Unity, I chose the resolution of 1080 * 1920. It looks like this
    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:
    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?
     
  2. sumpfkraut

    sumpfkraut

    Joined:
    Jan 18, 2013
    Posts:
    242
    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.
     

    Attached Files:

  3. unity_9031566D65309E6FC641

    unity_9031566D65309E6FC641

    Joined:
    Jan 31, 2022
    Posts:
    2
    Thanks! I tried, but it didn't work
     
  4. cejche

    cejche

    Joined:
    Oct 2, 2020
    Posts:
    1
    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:

     
  5. gridgeway24

    gridgeway24

    Joined:
    Apr 2, 2021
    Posts:
    1
    I have a similar issue. When I build the game it comes out super zoomed in. Not sure how to fix this, any suggestions?
     
    AndreaMar likes this.
  6. arshad05

    arshad05

    Joined:
    Mar 3, 2023
    Posts:
    1
    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.