better-unity-webgl-template icon indicating copy to clipboard operation
better-unity-webgl-template copied to clipboard

Can you choose a resolution lower than the screen's actual resolution?

Open Roozbehmd opened this issue 1 year ago • 2 comments

Fantastic work on the template. Only issue is that when viewed on high resolution screens it requires a lot of resources to run smoothly. Any way to lower the resolution and then upscale to fullscreen?

Roozbehmd avatar Mar 22 '23 20:03 Roozbehmd

You can try editing

Assets/WebGLTemplates/Better2020index.html

around line 30 add

        devicePixelRatio: 1,

as in

      const config = {
        devicePixelRatio: 1,  // <=---------  ADDED!
        dataUrl: buildUrl + "/{{{ DATA_FILENAME }}}",
        frameworkUrl: buildUrl + "/{{{ FRAMEWORK_FILENAME }}}",
        codeUrl: buildUrl + "/{{{ CODE_FILENAME }}}",
#if MEMORY_FILENAME
        memoryUrl: buildUrl + "/{{{ MEMORY_FILENAME }}}",
#endif
#if SYMBOLS_FILENAME
        symbolsUrl: buildUrl + "/{{{ SYMBOLS_FILENAME }}}",
#endif
        streamingAssetsUrl: "StreamingAssets",
        companyName: "{{{ COMPANY_NAME }}}",
        productName: "{{{ PRODUCT_NAME }}}",
        productVersion: "{{{ PRODUCT_VERSION }}}",
      };

you might be able to set it to 0.5 for even lower res.

Note: I didn't try it but it's mentioned here:

https://docs.unity3d.com/Manual/webgl-canvas-size.html

greggman avatar Mar 27 '23 04:03 greggman

Thank you!

Roozbehmd avatar Apr 16 '23 20:04 Roozbehmd