Unity Dev Blog: How to Host Your Unity Game on the Web
WebGL … Getting you game online. This is what it is all about!
In my last article, I discussed how to compile your game into a playable build. Today I will show you how to upload your game a hosting site so that you can share the link and others can play your game.
There are several ways to host your game online. I have used Simmer.io for a while now and like how easy it is to use.
Notice the two lines of text in the bottom left? It is really that easy.
After you create your account (it is free by the way), you can go back into Unity to create the WebGL build in order to upload it.
What is WebGL? Well, according to Wikipedia: (link)
To build and test your content for WebGL, choose the WebGL build target in the Build Player window, and click Build & Run.
In the Build Settings, Select WebGL and (if you need to) Switch Platform. Then click Build. Unity will ask you where to save the WebGL files so create a directory for that.
You game will compile…
Once Unity has completed compiling your game, it will automatically open the folder with the files for the WebGL build.
Now comes the easy part. In you browser window, go to the My Uploads section on your account at Simmer.io. Click the upload button and simply drag in the entire folder that was created during the Unity WebGL build.
Once the files are uploaded, the website will ask you a few questions about your gam. Fill out the game description and let them know what categories your game fits into for their search engines.
And that is it! Your game should load and be ready to play.
Now your game should be playable by just about anyone with a web browser.
Check out this game at https://simmer.io/@mlhatfield/galaxy-shooter-2d
So what’s next? While the game is good as it is, I’m sure some of you will find small bugs or you might even have some features that would be cool to add.
Here is my list of just a few future updates I have though of so far:
- Limiting ammo — ammo count indicator on the HUD along with ammo pick-ups at random times.
- Enemy laser fire.
- Allowing the shield to take more than one hit and changing the shield intensity based on the strength it has left.
- Health collectables to restore lost lives.
- Camera shake to go along with the explosions.
- An enemy wave system with a boss enemy after a certain number of waves.
- Different enemies for each wave. Each with their own movements and weapons.
Comment on the article to suggest other ideas!
I will start working on this list right away and share the steps in implementing them in tomorrow’s article.
See you there!