Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How to change the screen size of WebGL

Discussion in 'WebGL' 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:
    240
    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:

     
    tantx, Reactorcore and ManoKristos like this.
  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?