Mastering Unity Scripting
eBook - ePub

Mastering Unity Scripting

Alan Thorn

Buch teilen
  1. 380 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Mastering Unity Scripting

Alan Thorn

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Mastering Unity Scripting als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Mastering Unity Scripting von Alan Thorn im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Informatik & Programmierung in C#. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Jahr
2015
ISBN
9781784390655

Mastering Unity Scripting


Table of Contents

Mastering Unity Scripting
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Unity C# Refresher
Why C#?
Creating script files
Instantiating scripts
Variables
Conditional statements
The if statement
The switch statement
Arrays
Loops
The foreach loop
The for loop
The while loop
Infinite loops
Functions
Events
Classes and object-oriented programming
Classes and inheritance
Classes and polymorphism
C# properties
Commenting
Variable visibility
The ? operator
SendMessage and BroadcastMessage
Summary
2. Debugging
Compilation errors and the console
Debugging with Debug.Log – custom messages
Overriding the ToString method
Visual debugging
Error logging
Editor debugging
Using the profiler
Debugging with MonoDevelop – getting started
Debugging with MonoDevelop – the Watch window
Debugging with MonoDevelop – continue and stepping
Debugging with MonoDevelop – call stack
Debugging with MonoDevelop – the Immediate window
Debugging with MonoDevelop – conditional breakpoints
Debugging with MonoDevelop – tracepoints
Summary
3. Singletons, Statics, GameObjects, and the World
The GameObject
Component interactions
GetComponent
Getting multiple components
Components and messages
GameObjects and the world
Finding GameObjects
Comparing objects
Getting the nearest object
Finding any object of a specified type
Clearing a path between GameObjects
Accessing object hierarchies
The world, time, and updates
Rule #1 – frames are precious
Rule #2 – motion must be relative to time
Immortal objects
Understanding singleton objects and statics
Summary
4. Event-driven Programming
Events
Event management
Starting event management with interfaces
Creating an EventManager
Code folding in MonoDevelop with #region and #endregion
Using EventManager
Alternative with delegates
MonoBehaviour events
Mouse and tap events
Application focus and pausing
Summary
5. Cameras, Rendering, and Scenes
Camera gizmos
Being seen
Detecting the object visibility
More on the object visibility
Frustum testing – renderers
Frustum testing – points
Frustum testing – occlusion
Camera vision – front and back
Orthographic cameras
Camera rendering and postprocessing
Camera shake
Cameras and animation
Follow cameras
Cameras and curves
Camera paths – iTween
Summary
6. Working with Mono
Lists and collections
The List class
The Dictionary class
The Stack class
IEnumerable and IEnumerator
Iterating through enemies with IEnumerator
Strings and regular expressions
Null, empty strings, and white space
String comparison
String formatting
String looping
Creating strings
Searching strings
Regular expressions
Infinite arguments
Language Integrated Query
Linq and regular expressions
Working with Text Data Assets
Text Assets – static loading
Text Assets – loading from the local files
Text Assets – loading from the INI files
Text Assets – loading from the CSV files
Text Assets – loading from the Web
Summary
7. Artificial Intelligence
Artificial Intelligence in games
Starting the project
Baking a navigation mesh
Starting an NPC agent
Finite State Machines in Mecanim
Finite State Machines in C# – getting started
Creating the Idle state
Creating the Patrol state
Creating the Chase state
Creating the Attack state
Creating the Seek-Health (or flee) state
Summary
8. Customizing the Unity Editor
Batch renaming
C# attributes and reflection
Color blending
Property exposing
Localization
Summary
9. Working with Textures, Models, and 2D
Skybox
Procedural meshes
Animating UVs – scrolling textures
Texture painting
Step 1 – creating a texture blending shader
Step 2 – creating a texture painting script
Step 3 – setting up texture painting
Summary
10. Source Control and Other Tips
Git – source control
Step #1 – downloading
Step #2 – building a Unity project
Step #3 – configuring Unity for source control
Step #4 – creating a Git repository
Step #5 – ignoring files
Step #6 – creating the first commit
Step #7 – changing files
Step #8 – getting files from the repo
Step #9 – browsing the repo
Resources folder and external files
AssetBundles and external files
Persistent data and saved games
Summary
Index

Mastering Unity Scripting

Copyright © 2015 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: January 2015
Production reference: 1230115
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78439-065-5
www.packtpub.com

Credits

Author
Alan Thorn
Reviewers
Dylan Agis
John P. Doran
Alessandro Mochi
Ryan Watkins
Commissioning Editor
Dipika Gaonkar
Acquisition Editor
Subho Gupta
Content Development Editors
Melita Lobo
Rikshith Shetty
Technical Editors
Shashank Desai
Pankaj Kadam
Copy Editors
Karuna Narayanan
Laxmi Subramanian
Project Coordinator
Kinjal Bari
Proofreaders
Samuel Redman Birch
Ameesha Green
Indexer
Rekha Nair
Production Coordinator
Shantanu N. Zagade
Cover Work
Shantanu N. Zagade

About the Author

Alan Thorn is a London-based game developer, freelance programmer, and author with over 13 years of industry experience. He founded Wax Lyrical Games in 2010, and is the creator of the award-winning game, Baron Wittard: Nemesis of Ragnarok. He is the author of 10 video-training courses and 11 books on game development, including Unity 4 Fundamentals: Get Started at Making Games with Unity, Focal Press, UDK Game Development, and Pro Unity Game Development with C#, Apress. He is also a visiting lecturer on the Game Design & Development Masters Program at the National Film and Television School.
Alan has worked as a freelancer on over 500 projects, including games, simulators, kiosks, serious games, and augmented reality software for game studios, museums, and theme parks worldwide. He is currently working on an upcoming adventure game, Mega Bad Code, for desktop computers and mobile devices. Alan enjoys graphics. He is fond of philosophy, yoga, and also likes to w...

Inhaltsverzeichnis