Unity Game Development Essentials
eBook - ePub

Unity Game Development Essentials

  1. 316 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Unity Game Development Essentials

About this book

In Detail

Game engines are central to the video games we know and love. From the artwork to the mathematics that underpin the frames onscreen, the engine calls the shots. Aside from offering one of the leading 3D game engines, Unity also provides a superlative development tool - a tool that can produce professional standard games for Mac, PC, and the Unity Web Player.

This book is a complete exercise in game development covering environments, physics, sound, particles, and much more, to get you up and working with Unity quickly.

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. From creating 3D worlds to scripting and creating simple game elements you will learn everything you'll need to get started with game development for the PC, Mac, and Web.

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. 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!

Get started with game development using the Unity game engine with this hands-on, easy-to-follow guide

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 JavaScript and master the Unity development environment with easy to follow stepwise tasks.
The printed version of the book is in black and white, but a full color version of the images is available for download here. The eBook version, available from Packt, is in full color.

Who this book is for

If you're a designer or animator who wishes to take their first steps into game development, 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.

Trusted by 375,005 students

Access to over 1 million titles for a fair monthly price.

Study more efficiently using our study tools.

Information

Unity Game Development Essentials

Will Goldstone


Table of Contents

Unity Game Development Essentials
Credits
About the Author
About the Reviewers
Preface
What this book covers
Chapter 1—Welcome to the Third Dimension
Chapter 2—Environments
Chapter 3—Player Characters
Chapter 4—Interactions
Chapter 5—Prefabs, Collection, and HUD
Chapter 6—Instantiation and Rigidbodies
Chapter 7—Particle Systems
Chapter 8—Menu Design
Chapter 9—Finishing Touches
Chapter 10—Building and sharing
Chapter 11—Testing and further study
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the necessary assets for the book
Errata
Piracy
Questions
1. Welcome to the Third Dimension
Getting to grips with 3D
Coordinates
Local space versus World space
Vectors
Cameras
Polygons, edges, vertices, and meshes
Materials, textures, and shaders
Rigid Body physics
Collision detection
Essential Unity concepts
The Unity way
Assets
Scenes
Game Objects
Components
Scripts
Prefabs
The interface
The Scene window and Hierarchy
The Inspector
The Project window
The Game window
Summary
2. Environments
External modellers
Resources
Your first Unity project
Using the terrain editor
Terrain menu features
Importing and exporting heightmaps
Set Heightmap resolution
Creating the lightmap
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
Sun, Sea, Sand—creating the island
Step 1—Terrain setup
Step 2—Island outline
Step 3—Volcano!
Step 4—Adding textures
Painting procedure
Sandy areas
Grass & Rock
Volcanoes Rock!
Step 5—Tree time
Step 6—Grassed up
Step 7—Let there be lights!
Creating sunlight
Step 8—What's that sound?
Stereo versus Mono
Formats
The hills are alive!
Importing your first package
Further audio settings
Step 9—Look to the skybox!
Step 10—Open water
Step 11—Island walkabout
Step 12—Sun alignment and final tweaks
Take Me Home! Introducing models
Importing the model package
Common settings for models
Meshes
Materials
Animations
Setting up the outpost model
Summary
3. Player Characters
Working with the Inspector
Tags
Layers
Prefabs and the Inspector
Deconstructing the First Person Controller object
Parent-child issues
First Person Controller objects
Object 1: First Person Controller (parent)
Transform
FPSWalker (Script)
Character Controller
Mouse Look (Script)
Object 2: Graphics
Mesh filter
Mesh renderer
Object 3: Main Camera
Camera
GUILayer and Flare Layer
Mouse Look (Script)
Audio listener
Scripting basics
Commands
Variables
Variable data types
Using variables
Public versus private
Functions
Update()
OnMouseDown()
Writing functions
If else statements
Multiple conditions
Globals and dot syntax
Using static to define globals
Dot syntax
Comments
Further reading
The FPSWalker script
Launching the script
Mac—FPSWalker in Unitron
Windows PC—FPSWalker in Uniscite
Deconstructing the script
Variable declaration
Storing movement information
Moving the character
Checking grounded
@Script commands
Summary
4. Interactions
Exploring collisions
Ray casting
The frame miss
Predictive collision detection
Adding the outpost
Positioning
Scaling
Colliders and tagging the door
Disabling automatic animation
Opening the outpost
Approach 1—Collision detection
Creating new assets
Scripting for character collision detection
Working with OnControllerColliderHit
Writing custom functions
Declaring the function
Playing audio
Checking door status
Playing animation
Reversing the procedure
Function efficiency
Finishing the script
Attaching the script
Approach 2—Ray casting
Disabling collision detection—using comments
Resetting the door collider
Adding the ray
Summary
5. Prefabs, Collection, and HUD
Creating the battery prefab
Download, import, and place
Tagging the battery
Scale, collider, and rotation
Enlarging the battery
Adding a trigger collider
Creating a rotation effect
Saving as a prefab
Scattering batteries
Displaying the battery GUI
Creating the GUI Texture object
Positioning the GUI Texture
Scripting for GUI change
Battery collection with triggers
Restricting outpost access
Restricting access
Utilizing GetComponent()
Hints for the player
Battery GUI hint
GUI Text hint
Using fonts
Summary
6. Instantiation and Rigid Bodies
Introducing instantiation
In concept
In code
Passing in an object
Position and rotation
Introducing rigid bodies
Forces
The Rigidbody component
Making the minigame
Creating the coconut prefab
Creating the textured coconut
Adding physics
Saving as a prefab
Creating the Launcher object
Scripting coconut throws
Checking for player input
Playing feedback sound
Instantiating the coconut
Naming instances
Assigning velocity
Ensuring component presence
Safeguarding collisions
Including the Audio Source component
Script and variable assignment
Instantiate restriction and object tidying
Activating coconut throw
Removing coconuts
Adding the coconut shy...

Table of contents

  1. Unity Game Development Essentials

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Unity Game Development Essentials by Will Goldstone in PDF and/or ePUB format, as well as other popular books in Computer Science & Information Technology. We have over one million books available in our catalogue for you to explore.