Building your Game for WebGL in Unity

Frank Warman
4 min readJun 10, 2021

Well, we’ve reached the end of our small Game Development for Galaxy Shooter! It’s been a fun project to work on, and I’ve learned a lot from this experience and I hope you have to!

Now that our game is finished, it’s time to build our Game and publish it to a hosting site so that the world can play!

Hosted on itch.io

Building for WebGL

Luckily, when using Unity, switching between platforms is not much of a hassle and just involves a few clicks!

The first thing we need to do is to make sure that all of our Scenes are in order, so that our Game runs smoothly without hiccups.

So jump into your Build Settings by going to File>Build Settings (or hotkey CTRL+SHIFT+B):

Make sure that you have the Main Menu as Scene Index 0, and the Game as Scene index 1!

Then click on the WebGL platform on the left hand side, and click on the ‘Switch Platform’ button (where my ‘Build’ and ‘Build and Run’ buttons are in the picture above).

Let Unity do it’s thing and switch your files over, and when it’s complete you should see the Unity icon next to WebGL, denoting that is the current platform the project is built for.

Click on ‘Build’ and you’ll have to choose where to store your files:

If you don’t have a Builds folder, create one to keep your project tidy.

Then create a WebGL Build folder inside:

Click the ‘Select Folder’ button and Unity will begin building your Game!

Publishing/Hosting your Game online

There are many places to host your game online so that you can share the link with friends and family, but I’ve chosen to go with itch.io because it’s free and widely used.

To host on itch.io, we have to do some prep work beforehand. Mainly, making a proper zip of your WebGL build:

The highlighted files are the ones you want to select (inside of your WebGL Build folder) to zip into a zip folder.

  • * If you have WinRar installed, don’t compress into a .rar folder. It won’t work.
  • To zip files, select them, right-click, and select ‘Send To >’, then ‘Compressed Zip Folder’. (Only Windows, not sure for Mac, sorry!)

Now you can head over to itch.io:

Create a free account and make a memorable username. Once your profile is created, click on your profile in the top-right and select ‘Upload New Project’:

Underneath the uploads section is where you’ll be placing your zip folder on your game. Select ‘Upload files’ and link your zipped folder:

Once your game is properly uploaded, you’ll be required to fill out it’s title, description, etc. You can also upload Screenshots if you have any! This will help getting your game noticed.

Then once your game’s profile is complete, you can click Publish and now your game is ready to be played by the world!

It’s been a fun journey with this game, but now it’s time to move on to bigger and better things.

The next project I’ll be tackling is a Stealth Game where I’ll be getting my hands dirty with some Cinematography by creating some cutscenes! I’ll also be diving into some NavMesh AI movement/mechanics and much more.

I’ll detail the new project more in-depth in my next article!

Thanks for joining me in this first project! On to many more :)

--

--

Frank Warman

Audio Engineer turned Unity Game Dev. Will be combining both my skillsets when appropriate, and will be documenting my Unity Dev growth in these Medium Articles