Publishing Unity Games
Share:
In this tutorial, we'll learn how to publish Unity games for both Windows and macOS. Unity is a powerful cross-platform game development engine that allows developers to create 2D and 3D games and deploy them on numerous different platforms. By the end of this chapter, you'll be able to build your game into an executable file, ready to be distributed and played on multiple platforms.
Getting started
Firstly, you start by ensuring you have Unity installed and your project is ready to be published. You should have a functioning game without bugs and with all resources properly linked. For this tutorial, let's assume we have a game called 'Alien Invasion', where a brave character named McNulty has to defend his beloved city against an alien attack.
Next, we should ensure that the game has been fully tested. For instance, when McNulty destroys an alien spaceship, there should be an explosion, eliciting a rewarding sound. If not, you'd have to return to your Unity editor and correct all errors before proceeding to publishing.
Building the Project
Creating a build of your game involves compiling it into an executable form that others can run without needing the Unity editor. In order to do this, navigate to the File menu and select Build Settings.
File > Build Settings
On the Build Settings window that opens, you will see a list of platforms to choose from. Since we're focusing on Windows and macOS, we'll select those as our target platforms.
For Windows, Unity outputs a '.exe' executable along with a 'Data' folder that contains your game’s assets, levels, and other resources. This '.exe' file is what you will distribute to players, and when they run it, the Unity Player will start and play your game. If you're on a Mac and want to build for Windows, you need to ensure that the 'Windows Build Support' component is installed in Unity Hub.
For macOS, Unity exports a '.app' bundle that contains your game along with the Unity Player. This bundle is what you distribute to players.
Firstly, let's start with building for Windows.
Building your Unity Game for Windows
When Windows is selected as the platform in the Build Settings dialog, you will notice a number of options on the right-hand side.
- Target Platform: Allows you to select either x86 for 32 bit machines or x86_64 for 64 bit machines.
- Architecture: Choose between x86 for 32 bit Windows and x86_64 for 64 bit Windows.
- Development Build: Provide additional tools useful when developing and debugging your games.
In most cases, you'll just leave the defaults. Click the 'Build' button and Unity will prompt you for a location to save your game.
For instance,
Location: C:/Users/username/Desktop/Alien Invasion
A dialog box will pop up indicating the progress of the build. After finishing, Unity creates an '.exe' file in the chosen location.
Building your Unity Game for macOS
The process for building your game for macOS is very similar to Windows. Ensure macOS is selected under the platform, and then click 'Switch Platform'. This could take some time as Unity converts your game's assets for use on macOS.
After the platform switch is complete, you can also optionally choose between the 'x86' and 'x86_64' architectures. Unity actually recommends the use of 'x86_64' since it can use large amounts of memory and has better performance on mathematical operations.
Click the 'Build' button and just like before, Unity will prompt you for a location to save the game.
Conclusion
Remember, success entirely hinges on your game's reception by players. As a practice, always subject your game to a thorough round of testing before releasing it to the wider public. Nevertheless, with 'Alien Invasion' now published, McNulty is ready to take on the aliens on both Windows and macOS systems.
In the next chapter, we shall delve further into publishing for other platforms like Android and iOS. But for now, revel in your achievement. You can now publish a Unity Game! Dare to create, learn and explore in the endless world of game development.
0 Comment
Sign up or Log in to leave a comment