WebGL

While Unity's WebGL support for mobile is currently 'experimental', we've found it's possible to build great AR experiences with Unity and deploy to the web.

Unity's built-in WebGL template does not render the player window in fullscreen by default. The Zappar library provides an alternative template that shows a simple loading bar while the Unity content is loading, and fills the full browser window. You can use this template by navigating to the Resolution and Presentation section in the Player Settings menu and selecting the Zappar template.

For Unity 2019 and older versions, use the Zappar 2019 template. For Unity 2020 and above, use the Zappar template.

WebGL settings

When deploying to WebGL you'll want to run the publish command / upload the ZIP folder within the folder that's generated by Unity - it should contain an index.html file.

If you are using the ZapWorks CLI to serve your files, you will find that it does not send a Content-Encoding header for Unity's gzip/br files. Therefore, it is highly recommended that you go to Publishing Settings and enable Decompression Fallback in Unity2020 or above, or disable WebAssembly Streaming in Unity 2019.

Alternatively, you can also go into the project's Publishing Settings and set the Compression Format to be Disabled.

Note that 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.

For a more detailed step-by-step on how to build and publish to WebGL, head over to our Publishing article.

zapcode branded_zapcode i