Unity 4X Game Develo
Total Page:16
File Type:pdf, Size:1020Kb
Unity 4.x Game Development by Example Beginner's Guide A seat-of-your-pants manual for building fun, groovy little games quickly with Unity 4.x Ryan Henson Creighton BIRMINGHAM - MUMBAI Unity 4.x Game Development by Example Beginner's Guide Copyright © 2013 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: September 2010 Second edition: September 2011 Third edition: December 2013 Production Reference: 1191213 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-84969-526-8 www.packtpub.com Cover Image by Dan John Cox (http://danjohncox.tumblr.com/) Credits Author Project Coordinator Ryan Henson Creighton Venitha Cutinho Reviewers Proofreaders Trond Abusdal Elinor Perry-Smith Huzaifa Arab Mario Cecere John Hutchinson Bridget Braund Wei Wang Indexers Mariammal Chettiyar Acquisition Editors Wilson D'souza Mehreen Deshmukh Mary Jasmine Nadar Rekha Nair Owen Roberts Tejal Soni Lead Technical Editors Graphics Owen Roberts Sheetal Aute Poonam Jain Production Coordinator Nitesh Thakur Technical Editors Tanvi Bhatt Cover Work Akashdeep Kundu Nitesh Thakur Edwin Moses Nikhil Potdukhe Tarunveer Shetty Faisal Siddiqui Sonali Vernekar About the Author Ryan Henson Creighton is a veteran game developer, and the founder of Untold Entertainment Inc. (http://www.untoldentertainment.com) where he creatively consults on games and applications. Untold Entertainment creates fantastically fun interactive experiences for players of all ages. Prior to founding Untold, Ryan worked as the Senior Game Developer at Canadian media conglomerate Corus Entertainment, where he created over fifty advergames and original properties for the YTV, Treehouse TV, and W networks. Ryan is the co-creator of Sissy's Magical Ponycorn Adventure, the game he authored with his then five- year-old daughter Cassandra. Ryan is the Vice President of the IGDA Toronto Chapter. He is also the author of the book that you are currently reading. When Ryan is not developing games, he's goofing off with his two little girls and his fun-loving wife in downtown Toronto. Big thanks to Cheryl, Cassandra, and Isabel for their love, their support, and their cinnamon rolls. Thanks to Jean-Guy Niquet for introducing me to Unity; to Jim "McMajorSupporter" McGinley for help with the book outline and ongoing mentorship; to the technical reviewers and Packt Publishing staff for letting me leave a few jokes in the book; and to David Barnes, for having such a great sense of humor in the first place. Special thanks to Michael Garforth and friends from the #unity3d IRC channel on Freenode. I also want to thank Mom, God, and all the usual suspects. About the Reviewers Trond Abusdal, though having been interested in computers since his parents bought him and his brother a C64 in the early 90s, he first got into programming years later when writing a modification for Quake2 with a childhood friend. This interest lead to a bachelor's degree in Computer Science in 2006, after which he started working for TerraVision, a company using game technologies as a tool for education and visualization. In 2008, he first got introduced to Unity, which is still his main game development tool, although knowledge of other technologies and tools often come in handy. Since 2010, he is a programmer and more recently a partner at Rock Pocket Games, which makes games for a variety of different platforms, both client projects and internal projects. Huzaifa Arab is a Game Designer by choice and a Game Programmer by need. He has been playing games since young age, which progressed to Modding/Map-making/Scripting, when he realized that some games could be a whole lot more fun if he could put his own twist in them. And so, his hobby became a professional career choice after formally graduating from DSK Supinfogame, India (where his team won the prestigious Square Enix Game Dev Competition). After a year of freelance Game Development, he currently works at Tiny Mogul Games, India, as a Principal Game Designer. He loves to connect with people interested in Human Computer Interface, Game Engines/ VR Tech, Game Design in Education, and Instrumental music. You can drop him a line at [email protected]. I would like to thank Packt Publishing for giving me an opportunity to review a book on Unity 3D, a technology I am so passionate about. I would like to thank my best friend Angad for recommending me to Packt Publishing and I would like to thank my family and co-workers/friends for their support as I took time out to review such a wonderful book. John Hutchinson is the founder of Rubber Ducky Games, an independent game development studio based in California. In addition to being an exceptional programmer in multiple languages and frameworks, he is an experienced graphic designer, talented game system architect and gets excited about experience-focused design (and rubber duckies). He is especially interested in games which push the boundaries of twitch-reflex response, explore human emotion, or leverage the interactive medium for more powerful learning experiences. He is currently working with Making Friends Inc. as Lead Engineer and as part of the core design team, to deliver a game intent on teaching kids on the Autism-Asperger's spectrum valuable social skills. When his face isn't glued to a computer screen he likes to play with his kids, explore board game design, and read technical books like this one. Thanks to my brothers, for providing feedback (and teaching me some things about games). To my sister, for making me feel like a hero (not a robot). To my parents, for teaching me to be caring and to work my butt off. And to my kids, for just being you. I love you all more than words can express. Wei Wang made his first iOS casual game with Unity 3D in his college time, which got big success with more than 5 million downloads world-wide. Since then, he has discovered it's a great thing to make great games. After earning his master's degree from Tsinghua University (one of the best universities in China), he joined a game company in Japan and now he is trying to create interesting games with Unity 3D. Right now, he is a skilled engineer and always eager to learn more. He now lives in Kawasaki with his wife. You can know more about him from his project's page http://project. onevcat.com or find him on his blog http://onevcat.com (Chinese). You can also follow him on twitter @onevcat. www.PacktPub.com Support files, eBooks, discount offers and more You might want to visit www.PacktPub.com for support files and downloads related to your book. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. Why Subscribe? ‹ Fully searchable across every book published by ‹ Packt Copy and paste, print and bookmark content ‹ ‹ On demand and accessible via web browser ‹ ‹ Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access. Table of Contents Preface 1 Chapter 1: That's One Fancy Hammer! 9 Introducing Unity 3D 9 The engine, the tool, and the all-weather tires 10 Unity takes over the world 11 Why choose Unity? 11 Why burn this book and run away screaming? 12 Browser-based 3D – welcome to the future 13 Time for action – install the Unity Web Player 13 Welcome to Unity 3D! 14 What can I build with Unity? 14 FusionFall 14 Completely hammered 15 Should we try to build FusionFall? 15 Another option 16 Off-Road Velociraptor Safari 16 Fewer features, more promises 17 Maybe we should build Off-Road Velociraptor Safari? 17 I bent my Wooglie 17 Big Fun Racing 18 Diceworks 18 Lovers in a Dangerous Spacetime 20 Showcase Showdown 20 Unity Technologies – "Made with Unity" page 21 Kongregate 21 The iOS App Store 22 Table of Contents Walk before you can run (or double jump) 22 There's no such thing as "finished" 23 Stop! Hammer time 23 Fight Some Angry Bots 24 The wonders of technology! 26 The Scene window 26 The Game window 27 The Hierarchy