Building a Unity3D game for the web is simple! Once you build a game as WebGL, you can play it directly in your web browser.
In this article I’ll also show you how to upload it to the web with ease.
A Fractal Example
For this example I’ll use a 3D fractal from a Catlike Coding tutorial. You can download the unitypackage file from that tutorial and import it into Unity if you want to follow along.
First, open up the scene file and click "Play" to make sure the asset is correctly running.
Build your game for the web
File -> Build Settings
Select the WebGL platform and add any scenes needed for the game. Build & Run.
Optionally you can click the "Player Settings" button if you want to change options like the width & height of your Unity export. For this example I’ll leave those settings alone.
Once you’ve clicked "Build & Run", give your build a name. I chose "CatlikeWebGLBuild".
Grab a cup of coffee.
Boom! Your Unity WebGL game is now running in the browser.
Upload your game to the web
Go to https://simmer.io/upload and sign up for a free account if you don’t already have one.
Drag your "WebGLBuild" folder onto the drop area.
Here’s an example of the completed Unity WebGL demo. Click the play button to see a live demo:
Want to see how we embedded the above example on this blog? Check out Part II: How to Embed your Game on any Website