Unity: Building your game for the web
You’ve built and tested your game but now you want to share it with the world. One way to do this is to build it for WebGL and share it on the web. Here’s how.
Currently, our project is setup to build for Windows. To change this we need to go to File > Build Settings. Select WebGL and then click ‘Switch Platform’.
When we switch to WebGL we get a warning relating to the color space used in the project. Back when we were implementing post processing we changed this from Gamma to Linear; for WebGL we need to change it back.
In the Build Settings window click on ‘Player Settings’. Under ‘Player’ expand ‘Other Settings’ then change Color Space to Gamma. This does mean we won’t get the HDR color grading that we previously implemented, but these settings can be changed to complement WebGL.
With that done, we can go back to our Build Settings window and click ‘Build’ Select a suitable location for the build and wait for Unity to do it’s thing.
Bear in mind you may need a local web server installed to test this on your own PC. Alternatively you can create an account at itch.io and upload it there.
Once the build is complete, you can open index.html in the build folder to run your game in your web browser! If you host this on the web, you can now easily share your work.