Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Roozbehmd opened this issue Mar 22, 2023 · 2 comments
Open

Comments

@Roozbehmd
Copy link

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?

@greggman
Copy link
Owner

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

@Roozbehmd
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants