- Downloading Unity
- Introducing Our Development Environment
- Running Unity for the First Time
- Setting Up the Unity Window Layout
- Learning Your Way Around Unity
- Summary
Running Unity for the First Time
Hopefully reading all of that will have given Unity enough time to download in the background. Congratulations! You’re about to embark on a challenging but rewarding journey.
Installing Unity
Depending on your personal system settings, the Unity installer should have placed itself in a Downloads folder somewhere on your hard drive. I’m sure you’ve done this kind of thing several times before, so find the file, run the installer with all default options, and let’s get to work. This is a big install, so it could take a while. In the final bit of the installation, it may look like it has frozen; but don’t worry, just give it some time to complete.
Your First Launch: Licensing
The first time you run Unity, it will open a built-in web page that will ask you to create a license and register (see Figure 16.2), but it’s really quite painless, and it shouldn’t take much time at all. You will need to choose between the free license and a 30-day trial of Unity Pro. At this time, I recommend activating the free version of Unity, especially if you plan to work through this book slowly. The Pro version will be nice to have for the prototype you’ll make in Chapter 34, “QuickSnap,” so I recommend waiting until then to start the 30-day trial of Unity Pro. However, choosing the 30-day Unity Pro trial now would allow you to see the beautiful reflections and depth-of-field shaders in Figure 16.4.
You can choose to activate the 30-day trial any time, although you can only activate it once, and once the trial is over, you will be reverted to the free version. If you choose the free version now, you can always go back and upgrade to the Pro trial by selecting Unity > Manage License from the menu bar on OS X (on PC, choose Help > Manage License).
Figure 16.2 Unity licensing window
Once you click OK, you are prompted to create a Unity account. They’ll send you an email to confirm this (so you need to give them a valid email address). Then, you may be asked to take part in a survey, which you can choose to skip if you want (through a link at the bottom of the survey).
After this, Unity will automatically open the AngryBots demo project. This is a large project, so it may take several seconds to load. It may appear that Unity has frozen or is unresponsive, but if you wait a bit, everything will show up.
Example Project: AngryBots
When you first launch Unity, it will open a demo project and will show you a Welcome to Unity window that pops up over the main Unity window. For now, close the Welcome to Unity window, but feel free to explore the introductory videos and other links there later if you want more of an introduction to Unity than is provided in this chapter.
Unless you tell it not to (by holding the Option key at launch), Unity will open an existing project every time you launch it. The default project for this is AngryBots (see Figure 16.3), a game created internally by the Unity team to show off the capabilities of the engine. If for some reason the default scene doesn’t open automatically, you will need to double-click the AngryBots Scene Asset to open it; it should be the first one listed in the Project window pane in the bottom half of the screen. You’ll see Project and several other window panes on screen that I’ll explain later, but for now, just click the large Play button at the top of the Unity window (the triangle pointing to the right in the top, center of the Unity window) and enjoy playing this game for a while. You can read about the controls for this game in the nearby tip.
Figure 16.3 The Unity window when it opens for the first time
Here are some things to notice while you’re playing:
Shaders: AngryBots is rife with shaders (see Figure 16.4), code written specifically for the graphics card with the sole purpose of making the game look amazing. Special ones to check out include the following:
- The depth-of-field image effect that makes some parts of the scene in-focus while others are out-of-focus (see letter A in Figure 16.4). This will only appear in Unity Pro.
- The reflections on the floors (especially of the laser sight) (see letter B in Figure 16.4). This will only appear in Unity Pro.
- The animated water droplets on the floor when outside (see letter C in Figure 16.4). This appears regardless of whether you are using Unity Pro or free.
As explained earlier, if you chose to activate the free license rather than the 30-day Unity Pro trial, you will not see the most advanced shaders. This is one of the few differences between the free and Pro versions of Unity.
Figure 16.4 Screen showing the effects of various shaders
- Character rigging and animation: Unity makes use of animation blending to enable the player character to walk in one direction while looking and shooting in another.
- AI pathing: Enemies will move around objects in a room to find and attack the player.
Feel free to explore the whole space and see what elements of AngryBots you might want to use in your own project. Go ahead, I’ll wait.
...
...
So, what did you think? Did you blow up the base, or did you escape the exploding station? Did you find the white museum? The controls of this game are a little unusual, but regardless, it’s a good showcase for how beautiful Unity can look.
Now, let’s do something really cool.
Compile and Deploy AngryBots for the Web
Once you’ve clicked the blue Stop button at the top of the Unity window (the square next to the Play button), choose File > Build Settings from the menu bar (meaning that you should choose the item Build Settings from the File menu, as shown in Figure 16.5).
Figure 16.5 Build Settings menu selection
You should see the Build Settings window shown in Figure 16.6.
Figure 16.6 Unity build settings for the web player
From here, be sure to click Web Player on the left and then check Offline Deployment in the Web Player options area. Click Build and Run, and Unity will ask you where to save the files. Type AngryBots Web Build for the filename and click Save.
Unity will process this for a while and build a web version of the game for you. Once it’s built, your web browser will automatically be opened and sent to the page you just made as shown in Figure 16.7. Depending on your browser, you may be prompted to give the Unity plug-in permission to run.
Figure 16.7 AngryBots running in a browser window
And there you go. You’ve compiled AngryBots for the web. Unity makes things like this very easy so that you can focus on the interesting work: game design and development.