How to host Unity games on the web
If you don’t want a player to have to download your game there is a way that we can build out our game and upload it to a server. This way the player can play the game in the browser without having to download.
If you read my previous article about building and testing our space shooter you will know most of this. First the scenes need to be added the game build in the build settings.
Once in the build settings you then change the platform that your game can currently be built on. You need to select the WebGL option and click switch platform. This is take Unity a while to change some files that will allow for building out to a WebGL version.
Once the game is built out you will need to zip up the folder you have created for the WebGL build. This is so that we can upload it to a server and let others know that the game is ready to be played.
For this article I will be uploading to Itch.io, you could upload this to your own site and use an anchor tag to open the index.html file.
First, you will need an Itch.io account which is free. Once you have an account and are logged in you can click the arrow by your profile picture in the top right of the screen, then click upload new project.
This will bring you to another screen where we can begin the process.
You will need to give the game a Title, an a project URL, then in Kind of project you will need to select HTML. You then need to select Upload files and choose the zip folder you made earlier.
Now make sure to select the correct screen sizes and other options you need and then save and view the page.
And that’s it. Your page is ready to go live. Enjoy your game online and let others know about it.