Table Of ContentUnity 4 Fundamentals
This page intentionally left blank
Unity 4 Fundamentals
Get Started at Making Games with Unity
Alan Thorn
First published 2014 by Focal Press
70 Blanchard Road, Suite 402, Burlington, MA 01803
And in the UK by Focal Press
2 Park Square, Milton Park, Abingdon, Oxon OX14 4RN
Focal Press is an imprint of the Taylor & Francis Group, an informa business
© 2014 Taylor & Francis
The right of Alan Thorn to be identified as the author of this work has been asserted by him
in accordance with sections 77 and 78 of the Copyright, Designs and Patents Act 1988.
All rights reserved. No part of this book may be reprinted or reproduced or utilised in any
form or by any electronic, mechanical, or other means, now known or hereafter invented,
including photocopying and recording, or in any information storage or retrieval system,
without permission in writing from the publishers.
Notices
Knowledge and best practice in this field are constantly changing. As new research and
experience broaden our understanding, changes in research methods, professional
practices, or medical treatment may become necessary.
Practitioners and researchers must always rely on their own experience and knowledge
in evaluating and using any information, methods, compounds, or experiments
described herein. In using such information or methods they should be mindful
of their own safety and the safety of others, including parties for whom they have
a professional responsibility.
Product or corporate names may be trademarks or registered trademarks, and are used
only for identification and explanation without intent to infringe.
Library of Congress Cataloging-in-Publication Data
Thorn, Alan.
Unity 4 fundamentals: making games with Unity / Alan Thorn.—First edition.
pages cm.
1. Computer games—Programming. 2. Video games—Design.
3. Unity (Electronic resource) I. Title.
QA76.76.C672T498 2013
794.8'1526—dc23
2013023842
ISBN: 978-0-415-82383-8 (pbk)
ISBN: 978-0-203-54960-5 (ebk)
Typeset in Myriad Pro
By Apex CoVantage, LLC
Bound to Create
You are a creator.
Whatever your form of expression — photography, filmmaking,
animation, games, audio, media communication, web design, or
theatre — you simply want to create without limitation. Bound
by nothing except your own creativity and determination.
Focal Press can help.
For over 75 years Focal has published books that support your
creative goals. Our founder, Andor Kraszna-Krausz, established
Focal in 1938 so you could have access to leading-edge expert
knowledge, techniques, and tools that allow you to create
without constraint. We strive to create exceptional, engaging,
and practical content that helps you master your passion.
Focal Press and you.
Bound to create.
We’d love to hear how we’ve helped
you create. Share your experience:
www.focalpress.com/boundtocreate
v
This page intentionally left blank
Contents
Acknowledgements �����������������������������������������������������������������������������������������������������ix
About the Author ���������������������������������������������������������������������������������������������������������xi
Introduction ...............................................................................................................................................1
Chapter 1 Getting Started with Unity ............................................................................................7
Chapter 2 Assets and Asset Management ................................................................................33
Chapter 3 Scenes, Assets and Game Objects ...........................................................................49
Chapter 4 Terrain and Audio ............................................................................................................75
Chapter 5 Lighting and Lightmapping .......................................................................................91
Chapter 6 Particle Systems and Shuriken ..............................................................................117
Chapter 7 Scripting with C# ..........................................................................................................143
Chapter 8 GUIs and Scripting .......................................................................................................169
Chapter 9 Debugging and Post-processing ..........................................................................197
Chapter 10 Navigation and Pathfinding .................................................................................225
Chapter 11 Animation and Mecanim .......................................................................................239
Chapter 12 Tips and Tricks .............................................................................................................273
Afterword ������������������������������������������������������������������������������������������������������������������285
Index ��������������������������������������������������������������������������������������������������������������������������287
vii
This page intentionally left blank
Acknowledgements
This book would not have been possible without the valuable help and skills of many
people. There are too many to list here individually, but I feel specific mention should
go to Sean Connelly for arranging the book in the first place and for his ideas and
suggestions along the way, and to Caitlin Murphy for editing and coordinating my
work. I’d also like to give thanks to the technical reviewers, for spotting my slip-ups
and mistakes, and to the rest of the Focal Press team who contributed in some way
but whom I never got to know. And finally, I’d like to thank you, the reader, for taking
the time and effort to explore the Unity engine through this book. I hope you find it
helpful.
Alan Thorn, London, 2013
ix