Book Image

Unity 4.x Game Development by Example: Beginner's Guide - Third Edition

By : Ryan Henson Creighton
Book Image

Unity 4.x Game Development by Example: Beginner's Guide - Third Edition

By: Ryan Henson Creighton

Overview of this book

Unity is one of the biggest game engines in the world, providing the user with a range of important tools that they need to bring their ideas into reality. Beginner game developers are optimistic, passionate, and ambitious, but that ambition can be dangerous! Too often, budding indie developers and hobbyists bite off more than they can chew. Games like Angry Birds, Cut the Rope, and Fruit Ninja are fun, simple games that have delighted players and delivered big profits to their creators. This is the perfect climate for new game developers to succeed by creating simple games with Unity, starting today. This book teaches you the ins and outs of the unique Unity game engine interface. Clear and concise code examples written in both Unity Javascript and C# take you through the step-by-step process of building five small, functional games. With this understanding you can start making your own mark on the game industry! With absolutely no programming or game development experience, you will learn how to build five simple games in Unity by following step-by-step instructions, peppered with amusing analogies and anecdotes from an experienced indie developer. Following a primer on simplifying your game ideas to that single “something” that keeps players coming back for more, dive into the Unity game engine by creating a simple bat-and-ball game. From there, you'll build a complete memory game using only the Unity GUI system. After building a 2.5D mouse avoider game, you'll learn how to re-skin the project to completely change the game's theme. Incorporating everything you've learned, you'll return to complete the bat-and-ball game by adding scoring, replay flow, sound effects, and animations. Finally, in the new bonus chapter, you'll program some simple AI (Artificial Intelligence) for a tic tac toe game. "Unity 4.x Game Development by Example" is a fun and light-hearted exploration of one of the most powerful game engines on the market today. Find out what all the fuss is about by getting up to speed using this book!
Table of Contents (22 chapters)
Unity 4.x Game Development by Example Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Stop! Hammer time


Now that you've seen some of what Unity can do, it's time to download the program and kick the tires! The free version of Unity is available for a low price of... well, free (at the time of this writing) from the Unity 3D website.

  1. Go to http://unity3D.com.

  2. Click on the Download button.

  3. Download the latest version of the Unity 3D authoring tool for your platform—Mac or PC. If you are given the option, make sure to download the sample project along with the program.

  4. Follow all the onscreen prompts until the Unity authoring tool has finished installing.

  5. Launch Unity!

Fight Some Angry Bots

After a quick registration process, Unity is ready to go. With any luck, the AngryBots Demo will automatically open. If it doesn't, and you're faced with a dialogue asking you to open a project, you can find the AngryBots Demo in the following location by default:

  • Max OS: /Users/Shared/Unity/4-0_AngryBots

  • Windows XP: C:\Documents and Settings\All Users\Documents\Unity Projects\4-0_AngryBots

    or

  • C:\Documents and Settings\All Users\Shared Documents\Unity Projects\4-0_AngryBots

  • Windows 7/ 8/ Vista: C:\Users\Public\Public Documents\Unity Projects\4-0_AngryBots

If you thought you'd be a rebel and you unchecked the sample projects box when you downloaded Unity, you may find yourself re-downloading Unity to get the AngryBots Demo. You can pull down other sample learning projects, such as the AngryBots Demo from the Unity website:

http://unity3d.com/support/resources/example-projects/

Note

These paths may change depending on which version of Unity you've downloaded. As the Unity Technologies team improves the software, they launch new and more impressive demos to show off what Unity can do. If you're reading this book, and your copy of Unity 3D launches a different demo project, or if the Angry Bots Demo is no longer available by the time you begin reading this book, don't freak out! Everything we're about to discuss can be generally applied to most demos.

When the Angry Bots Demo first opens, you may see a splash screen referring you to different tutorial resources and language guides. How helpful! Now close it (don't worry, it'll be there next time, unless you uncheck the Show at Startup box). If you checked the box but you'd really like to see that welcome screen again, look in the menus under Help | Welcome Screen. In the menus, click on Window | Layouts | 2 by 3 to see the different panels that we're about to tour.

After the panels have repositioned themselves, look for the Project panel. It should be one of the three vertically oriented panels on the right half of your screen. At the top right of the Project panel is a very small button that looks like a downward-facing triangle next to three horizontal lines. Click there, and choose One Column Layout from the resulting context menu. This will get an annoying split view out of your way:

If you don't see all the fancy highfalutin' 3D jazz going on in the Scene and Game windows, you may just need to load the main game scene. To do this, find the Scene called AngryBots at the top of the Project panel (it has a black-and-white Unity icon next to it), and double-click it.

To try out the demo, click on the Play button at the top center of the screen:

You can walk around the Angry Bots Demo using the WASD keys on your keyboard. Hold down the left-mouse button to fire your boomstick at the aggravated automatons. When you're finished exploring, press the Esc key to pause the game and regain mouse control. Then click on the Play button again to end the demo: