Unity 3.x Game Development Essentials
eBook - ePub

Unity 3.x Game Development Essentials

Game development with C# and Javascript

Will Goldstone

Condividi libro
  1. 488 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Unity 3.x Game Development Essentials

Game development with C# and Javascript

Will Goldstone

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

In Detail

Game Engines such as Unity are the power-tools behind the games we know and love. Unity is one of the most widely-used and best loved packages for game development and is used by everyone, from hobbyists to large studios, to create games and interactive experiences for the web, desktop, mobile, and console. With Unity's intuitive, easy to learn toolset and this book - it's never been easier to become a game developer.

Taking a practical approach, this book will introduce you to the concepts of developing 3D games, before getting to grips with development in Unity itself - prototyping a simple scenario, and then creating a larger game. From creating 3D worlds to scripting and creating game mechanics you will learn everything you'll need to get started with game development.

This book is designed to cover a set of easy-to-follow examples, which culminate in the production of a First Person 3D game, complete with an interactive island environment. All of the concepts taught in this book are applicable to other types of game, however, by introducing common concepts of game and 3D production, you'll explore Unity to make a character interact with the game world, and build puzzles for the player to solve, in order to complete the game. At the end of the book, you will have a fully working 3D game and all the skills required to extend the game further, giving your end-user, the player, the best experience possible. Soon you will be creating your own 3D games with ease!

Approach

This book follows an informal, demystifying approach to the world of game development with the Unity game engine. With no prior knowledge of game development or 3D required, you will learn from scratch, taking each concept at a time working up to a full 3D mini-game. You'll learn scripting with C# or JavaScript and master the Unity development environment with easy-to-follow stepwise tasks.

Who this book is for

If you're a designer or animator who wishes to take their first steps into game development or prototyping, or if you've simply spent many hours sitting in front of video games, with ideas bubbling away in the back of your mind, Unity and this book should be your starting point. No prior knowledge of game production is required, inviting you to simply bring with you a passion for making great games.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Unity 3.x Game Development Essentials è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Unity 3.x Game Development Essentials di Will Goldstone in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Informatica e Programmazione in C#. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2011
ISBN
9781849691444
Edizione
1
Argomento
Informatica

Unity 3.xGame Development Essentials

Game development with C# and Javascript


Table of Contents

Unity 3.x Game Development Essentials
Credits
Foreword
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
Getting help with the book and updates
Conventions
Reader feedback
Customer support
Downloading the book asset bundle
Downloading the color images of this book
Errata
Piracy
Questions
1. Enter the Third Dimension
Getting to grips with 3D
Coordinates
Local space versus world space
Vectors
Cameras
Projection mode—3D versus 2D
Polygons, edges, vertices, and meshes
Materials, textures, and shaders
Rigidbody physics
Collision detection
Essential Unity concepts
The Unity way—an example
Assets
Scenes
GameObjects
Components
Scripts
Prefabs
The interface
The Scene view and Hierarchy
Control tools
Flythrough Scene navigation
Control bar
Search box
Create button
The Inspector
The Project window
The Game view
Summary
2. Prototyping and Scripting Basics
Your first Unity project
A basic prototyping environment
Setting the scene
Adding simple lighting
Another brick in the wall
Building the master brick
And snap!—It's a row
Grouping and duplicating with empty objects
Build it up, knock it down!
Setting the viewpoint
Introducing scripting
A new behaviour script or 'class'
What's inside a new C# behaviour
Basic functions
Variables in C#
What's inside a new Javascript behaviour
Variables in Javascript
Comments
Wall attack
Declaring public variables
Assigning scripts to objects
Moving the camera
Local, private, and public variables
Local variables and receiving input
Understanding Translate
Implementing Translate
Testing the game so far
Making a projectile
Creating the projectile prefab
Creating and applying a material
Adding physics with a Rigidbody
Storing with prefabs
Firing the projectile
Using Instantiate() to spawn objects
Adding a force to the Rigidbody
Summary
3. Creating the Environment
Designing the game
Using the terrain editor
Terrain menu features
Importing and exporting heightmaps
Setting the resolution
Mass place trees
Flatten Heightmap
Refresh tree and detail prototypes
The terrain toolset
Terrain Script
Raise height
Paint height
Smooth Height
Paint Texture
Place Trees
Paint Details
Terrain Settings
Creating the island—sun, sea, and sand
Step 1—Setting up the terrain
Step 2—Creating the Island outline
Step 3—Volcano!
Step 4—Adding textures
Painting procedure
Sandy areas
Grass & Rock
Volcanoes rock!
Step 5—Tree time
Step 6—The grass is always greener
Step 7—Let there be lights!
Creating sunlight
Step 8—What's that sound?
Sounds—2D versus 3D
Audio file formats
The hills are alive!
Importing the book's asset package
Further audio settings
Step 9—Look, there! Up in the skybox!
Step 10—Open water
Step 11—Going walkabout
Step 12—Final tweaks
Summary
4. Player Characters and Further Scripting
Working with the Inspector
Tags
Layers
Prefabs and the Inspector
Anatomy of a character
Deconstructing the First Person Controller object
Parent-child issues
First Person Controller object
Object 1: First Person Controller (parent)
Transform
Character Controller
Mouse Look (Script)
Character Motor (Script)
FPSInput Controller (Script)
Object 2: Graphics (child)
Mesh filter
Mesh Renderer
Object 3: Main Camera (child)
Camera
GUILayer and Flare Layer
Mouse Look (Script)
Audio listener
Further scripting
Commands
Variables
Variable data types
Using variables
Public versus private variables
Declaring public and private variables
Full example
Functions
Update()
OnMouseDown()
Writing custom functions
Return type
Arguments
Declaring a custom function
Calling a custom function
If else statements
C#:
Multiple conditions
For loops
Inter-script communication and Dot Syntax
Accessing other objects
Find() and FindWithTag()
SendMessage
GetComponent
Programming for Mobile
Dot Syntax
Comments
Further reading
Scripting for character movement
Deconstructing the script
Full script (Javascript)
Variable declaration
Storing movement information
Moving the character
Checking grounded
@Script commands
Summary
5. Interactions
External modeling applications
Common settings for models
Meshes
Normals and Tangents
Materials
Animations
Animation Compression
Setting up the outpost model
Adding the outpost
Positioning
Rotation
Adding colliders
Adding the Rigidbody
Adding audio
Disabling automatic animation
Collisions and triggers
Ray casting
The frame miss
Predictive collision detection
Opening the outpost
Approach 1—Collision detection
Creating new assets
Scripting for character collision detection
Working with OnControllerColliderHit
OpenDoor() custom function
Declaring the function
Checking door status
Playing audio
Testing the script
Extending colliders
Playing animation
Reversing the procedure
Code maintainability
Drawbacks of collision detection
Approach 2—Ray casting
Disabling collision detection with comments
Migrating code—writing a DoorManag...

Indice dei contenuti