Setting up the build settings

There are many times during development that you may want to see what your game looks like if you build it outside of the editor. It can give you a sense of accomplishment; I know, I felt that way the first time I pushed a build to a console devkit. Whether it's for PC, Mac, Linux, web player, mobile, or console, we all have to go through the same menu, the Build Settings menu. We perform the following steps:

  1. We are going to first open our Twinstick Shooter project that we created back in Chapter 1, 2D Twin-stick Shooter, Chapter 2, Creating GUIs. Open up your main menu scene (in the example code, it is saved as Main_Menu). Take a look at the following screenshot:
    Setting up the build settings
  2. To access our Build Settings menu, we will need to navigate to File | Build Settings from the top menu (or press Ctrl + Shift + B). Take a look at the following screenshot:
    Setting up the build settings
  3. If you have been following thoroughly from Chapter 2, Creating GUIs, you should see two icons in the Scenes In Build section. If you have not, click on the Add Open Scenes button for each level.

    Note

    Another way to add levels to your build is to just drag and drop them from the project browser. It's also important to note that you can also drag them around to order them however you want. The level that is at index 0 will be the one that the game starts with.

  4. Once you're ready, select a platform from the bottom-left corner menu. The Unity logo shows which one you're currently compiling for. We're going to compile for Windows now, so if it is currently not set to PC, Mac, and Linux Standalone, select that, and click on the Switch Platform button if needed.
  5. Once you have all this set up, click on the Build button. Once this is done, it will ask you for a name and a location to put the game in. I'm going to name it TwinstickShooter and put it in an Export folder located in the same directory as the Assets and Library folder. Afterward, hit Save. Take a look at the following screenshot:
    Setting up the build settings
  6. You may need to wait a bit, but as soon as it finishes, it will open up the folder with your new game. Take a look at the following screenshot:
    Setting up the build settings

When building for Windows, you should get something like the preceding screenshot. We have the executable, but we also have a data folder that contains all the assets for our application (right now called TwinstickShooter_Data). You must include the data folder with your game, or it will not run. This is a slight pain, but later on in this chapter, we will create an installer so that we can put it on a computer without any hassle.

If you build for Mac, it will bundle the app and data all together, so once you export it, all you need to give people is the application.

Note

If you are interested in submitting your Mac game to the Mac App Store, there is a nice tutorial about doing just that at http://www.conlanrios.com/2013/12/signing-unity-game-for-mac-app-store.html.

If you double-click on the .exe file to run the game, you'll be brought to the following startup menu, as shown in the following screenshot:

Setting up the build settings

This will allow players to customize their Screen Resolution values as well as other options, such as what buttons to use for input. I personally feel that this menu makes projects look more unprofessional, so I'll be teaching you how to remove this as well.

Anyway, once we click on the Play! button, we'll be taken to the proper game screen, as shown in the following screenshot:

Setting up the build settings

And it's working great. We can work at any resolution that we choose, and all the menus are functioning as well!

Note

For more information on publishing and specific things to look out for, check out the following link:http://docs.unity3d.com/Manual/PublishingBuilds.html

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset