better-unity-webgl-template
better-unity-webgl-template copied to clipboard
Can you choose a resolution lower than the screen's actual resolution?
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?
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
Thank you!