How to Setup a WebGL Build for Your Game in Unity

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!




Passionate Unity Game Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

CORS Errors- Part 1: a brief introduction

To begin developing a system, identifying the flow is a must.

How to Iterate a HashMap in Java?

Introducing Serverless Tasks in Snowflake

A NeoPixel-Based Badge for Pride!

How Python Represents Integers using Bignum

Looking back at February

Working With PHP’s Date and Time Classes

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chris Hilton

Chris Hilton

Passionate Unity Game Developer

More from Medium

Creating a UI Shield Strength indicator

Understanding the Body Settings in Cinemachine Virtual Cameras

Galaxy Shooter — Powerup Magnet

Understanding Frustum and Occlusion Culling in Unity3D