Getting Started with Unity (Part 11: Build and Deploy Your Game!)
The time has come. You’ve got a great game together and it’s ready for primetime. Let’s cover some options for building your game so that others can play it.
Firstly, don’t be intimidated by this step as Unity makes it very easy to export your game to whichever platform you desire. Let’s look at PC and Mac first.
PC & Mac Builds
To access the build menu, navigate to File -> Build Settings.
You’ll see the default option set to PC, Mac, and Linux standalone, and on the right you can select your Target Platform between the options.
Before you hit build, click on Player Settings and be sure everything here matches what you would like to have exported as the final product.
Here you can control details such as your company name, product name, and version, as well as settings for playback such as the fullscreen mode and default resolution. One note on fullscreen mode — if you choose “Exclusive Fullscreen” as your build option, be sure you have an “Escape” or “Quit” function in your game to prevent players from getting locked in your game and needing to force quit. Once you’ve chosen your settings you can exit that window.
We’re ready to build! Once you click build and save your game to a location (create a new folder for this, ex “Windows Playable Build”), this will automatically compile your project to be recognized by your chosen platform, and you can easily build again for another platform right after if you need to. Easy peasy!
Once your build has finished compiling Unity will open the folder containing your build with a playable file (.exe on Windows or .dmg on Mac). Play your game to test it out, and you’re ready to share it. Be sure to share the whole “Playable Build” folder so that all of the dependencies are included.
WebGL Builds (play in browser)
WebGL builds are a great way to share your games with friends (and the world!) because they allow you to create a version of the game that can be hosted and played directly online, regardless of computer operating system.
To build for WebGL, we need to make a few changes in our build settings. First, make sure you have it installed — if you see an option for “Install with Unity Hub” you will need to do that before proceeding.
Next we must select “Switch Platform” to recompile our code for use with WebGL. Once that is complete, we need to also switch to Gamma as our ColorSpace selection (versus HDR colors). Ready to build! Select Build, choose a folder to host your playable game, and save.
Once your build is ready, zip the folder and then you can upload this zipped file for free to platforms like itch.io where you can host your game for everyone to play in their browser. I’ll cover this in more detail in a short follow-up guide. See ya there!