How to Host Unity Games on the Web

Marc Frappier
3 min readJul 21, 2023

--

How to reach a wider audience

WebGL

In order to create a version of our game that can be uploaded and played in a browser, we must have Unity compile our game using WebGL.

To do this, in Unity, go to File > Build Settings and select WebGL.

Selecting WebGL

Notice we have an error with the Color Space and the current settings. We must resolve this before we continue.

Color Space error

The first step is to Switch platform. We do this by selecting the Switch Platform button.

This will recompile our game so it is compatible with the WebGL environment.

Recompiling game for WebGL environment

Once it has recompiled, we need to address the Color Space issue. To do this, select Player Settings.

Player Settings

A new window will popup with the Project Settings.

Project Settings

Now we need to select Other Settings so we can access the Color Space. Right now it is set to Linear and we need to change it to Gamma.

Unity will recompile using the new Gamma Color Space.

Gamma Color space activated

Once compiled, we can close this window and compile a new WebGL build.

Unity will ask us for a location to store our files. Create a new folder, I will call it WebGL demo.

Select the folder and Unity will now start to compile your game for WebGL.

When it has finished compiling, the folder you selected will open and you will be able to see your files and folders created by Unity.

WebGL files

You would upload this file and two folder to a web server so others could access and play your game.

I hope you enjoyed this tutorial. See you in the next one.

--

--

Marc Frappier

Poultry Scientist by profession, Computer Scientist at heart. After many years in the poultry business, I have decided to give my passion for technology a shot.