How to Host Unity Games for the Web
Building in the WebGL Platform
A fun way to showcase your games is to build them in WebGL. In order to do this, there are a few changes you have to make in Unity.
- First, click on File at the top of the Unity window and select Build Settings.
- Select WebGL in the Platform list and then click the “Switch Platform” button.
Note: If you don't already have the WebGL platform installed, your screen will give you an option to install WebGL through the Unity Hub. You will need to do this if you want to switch to the WebGL platform and host your games on the internet.
You will see that we need to modify the Color Space in order for the Build to compile properly.
- With the Build Settings window already open, click on the “Player Settings” button.
- Be sure you have “Player” selected in the Project Settings list.
- Click on the “Other Settings” drop down and change the Color Space to “Gamma”. This may take a minute or so to compile.
- Once Unity is done compiling, close the “Player Settings” window.
After Unity compiles, you can now Build in the WebGL platform.
- In the “Build Settings” window, click on the “Build” button.
- Select/Create the folder to store the WebGL Build and click the “Select Folder” button.
Unity will compile the project and save it in the selected folder. If you want to play it on the internet, you will have to upload the files/folders that were created onto the website where you plan to host your games.