If you are building for WebGL then you can test your projects by serving the content locally using the ZapWorks CLI.
Due to browser restrictions surrounding the use of the camera, you must use
HTTPS to view or preview your site, even if doing so locally from your computer. This means that Unity's Build and Run option will not work for previewing and testing your project.
Serving Content Locally
To serve your WebGL output folder over
HTTPS for access on your local computer:
You can also serve the folder for access by other devices on your local network:
zapworks serve --lan
Remember to run these commands within the folder that's generated by Unity when you build your project for WebGL - it should contain an
The ZapWorks CLI does not send a
Content-Encoding header for Unity's gzip files, so it's best to set the
Publishing settings > Compression Format setting to
Disabled or by enabling the
Publishing Settings > Decompression fallback.
Note you can also make use of menu option Zappar/Editor/Update Project Settings To Publish to make these specific changes around setting WebGL-Template and compression settings. Though you should always double check to confirm.
ZapWorks provides complete serving and hosting for your WebGL-based experiences, should you wish to use it. Find out more on our Hosting article.