How to Setup a WebGL Build for Your Game in Unity

Chris Hilton
2 min readJul 18, 2021

Objective: To get your game setup for a WebGL build in Unity!

Now that we have previously walked through getting your game built for Windows/Mac, it is time to take the next step and share it with the World! Maybe you might want your friends, family or work colleagues to give it a go in order to provide some valuable feedback to you to help polish the final product? or, it is that damn good that you just want people to play it as soon as possible! Either way, let’s get your Unity game on the web.

Build Settings

Firstly, similar to building on PC/Mac let’s head over to the Build Settings menu and this time we are going to choose the WebGL platform.

Now depending on how you have built your game, you may run into an incompatibility error with Color Space rendering. E.g. I had previously changed this to Linear from Gamma for my Post Processing effects.

To get this uploaded we need to resolve this error, by going to Player Settings → Player → WebGL Settings tab → Other Settings → Rendering → Color Space → Gamma.

Now that we have completed this step it is time to ‘Switch Platform’. This may take a few minutes to complete so feel free to grab a delicious cup of coffee at this stage, I know I am.

We can now press the ‘Build’ button and similarly with the PC/Mac build it will ask you to find a folder you wish to save this in. It is best to place this into a new folder to prevent this Visual Studio error code from popping up:

Once this has finished, you should be good to open your index.html file and start playing!

--

--