Introduction to Unity
By John Bura, Alexandra Kropova and Glauco Pires
()
About this ebook
The first part of this book is an introduction to Unity for those who have never used it before. You learn the interface, set up scenes, and make game objects. We create a 2D game where a player shoots a bullet at a wall to trigger an explosion.
In Part Two, we create a 3D shooter game where a player enters a castle and attacks enemies. You learn how to customize the appearance and behavior of objects using C# scripts. You learn crucial concepts of coding in C# for Unity: variables, methods, input, and more.
By the end of this book, you have a 2D bullet explosion game and a 3D VR shooter game that you can show off in your portfolio.
Read more from John Bura
Build 6 Games In Unreal Rating: 0 out of 5 stars0 ratingsBuild a 3d Virtual Reality Whackamole Game Rating: 0 out of 5 stars0 ratingsLearn Css In 1 Hour Rating: 0 out of 5 stars0 ratingsLearn Html In 1 Hour Rating: 0 out of 5 stars0 ratingsLearn Javascript In 1 Hour Rating: 0 out of 5 stars0 ratingsUltimate Ios 10, Xcode 8 Development Book: Build 30 Apps Rating: 0 out of 5 stars0 ratingsIntroduction to Unreal Rating: 0 out of 5 stars0 ratingsConstruct 2 Game Development by Example Rating: 0 out of 5 stars0 ratings
Related to Introduction to Unity
Related ebooks
NGUI for Unity Rating: 0 out of 5 stars0 ratingsGameSalad Essentials Rating: 0 out of 5 stars0 ratingsBeginning Unreal Engine 4 Blueprints Visual Scripting: Using C++: From Beginner to Pro Rating: 0 out of 5 stars0 ratingsBecoming Comfortable with Unity Rating: 0 out of 5 stars0 ratingsCRYENGINE Game Development Blueprints Rating: 0 out of 5 stars0 ratingsLearning Unity iOS Game Development Rating: 0 out of 5 stars0 ratingsA Quick Guide to 2d Infinite Runners with Unity: Quick Guides, #3 Rating: 0 out of 5 stars0 ratingsUnity 3.x Game Development Essentials: Game development with C# and Javascript Rating: 0 out of 5 stars0 ratingsIntroduction to Unreal Rating: 0 out of 5 stars0 ratingsBuilding Levels in Unity Rating: 0 out of 5 stars0 ratingsBuilding an FPS Game with Unity Rating: 0 out of 5 stars0 ratingsGame Programming with Unity and C#: A Complete Beginner’s Guide Rating: 0 out of 5 stars0 ratingsGetting Started with 3D Animation in Unity: Getting Started, #1 Rating: 0 out of 5 stars0 ratingsA Quick Guide to Artificial Intelligence with Unity: Quick Guides, #4 Rating: 0 out of 5 stars0 ratingsOpenGL Game Development By Example Rating: 0 out of 5 stars0 ratingsAndroid Game Programming by Example Rating: 0 out of 5 stars0 ratingsPractical Shader Development: Vertex and Fragment Shaders for Game Developers Rating: 0 out of 5 stars0 ratingsWindows 8.1 Bible Rating: 0 out of 5 stars0 ratingsBeginning Unreal Game Development: Foundation for Simple to Complex Games Using Unreal Engine 4 Rating: 0 out of 5 stars0 ratingsBlender 2.6 Cycles:Materials and Textures Cookbook Rating: 0 out of 5 stars0 ratingsUnity 5 Game Optimization Rating: 0 out of 5 stars0 ratingsPapervision3D Essentials Rating: 0 out of 5 stars0 ratingsLearning Construct 2 Rating: 0 out of 5 stars0 ratingsUnreal Development Kit Game Programming with UnrealScript Beginner's Guide Rating: 3 out of 5 stars3/5Minecraft Story Mode the Complete Adventure Game Xbox One, Wii U, PS3, Download, Unofficial Guide Rating: 0 out of 5 stars0 ratingsCoding in the Real World Rating: 0 out of 5 stars0 ratingsCryENGINE Game Programming with C++, C#, and Lua Rating: 0 out of 5 stars0 ratingsMastering Unity: Advanced Techniques for Interactive Design: Unity Game Development Series Rating: 0 out of 5 stars0 ratingsOuya Unity Game Development Rating: 0 out of 5 stars0 ratings
Computers For You
Standard Deviations: Flawed Assumptions, Tortured Data, and Other Ways to Lie with Statistics Rating: 4 out of 5 stars4/5Elon Musk Rating: 4 out of 5 stars4/5The Invisible Rainbow: A History of Electricity and Life Rating: 5 out of 5 stars5/5Slenderman: Online Obsession, Mental Illness, and the Violent Crime of Two Midwestern Girls Rating: 4 out of 5 stars4/5The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution Rating: 4 out of 5 stars4/5Procreate for Beginners: Introduction to Procreate for Drawing and Illustrating on the iPad Rating: 0 out of 5 stars0 ratings101 Awesome Builds: Minecraft® Secrets from the World's Greatest Crafters Rating: 4 out of 5 stars4/5Remote/WebCam Notarization : Basic Understanding Rating: 3 out of 5 stars3/5Uncanny Valley: A Memoir Rating: 4 out of 5 stars4/5CompTIA IT Fundamentals (ITF+) Study Guide: Exam FC0-U61 Rating: 0 out of 5 stars0 ratingsThe Professional Voiceover Handbook: Voiceover training, #1 Rating: 5 out of 5 stars5/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 5 out of 5 stars5/5Alan Turing: The Enigma: The Book That Inspired the Film The Imitation Game - Updated Edition Rating: 4 out of 5 stars4/5Deep Search: How to Explore the Internet More Effectively Rating: 5 out of 5 stars5/5Excel 101: A Beginner's & Intermediate's Guide for Mastering the Quintessence of Microsoft Excel (2010-2019 & 365) in no time! Rating: 0 out of 5 stars0 ratingsThe ChatGPT Millionaire Handbook: Make Money Online With the Power of AI Technology Rating: 4 out of 5 stars4/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Tor and the Dark Art of Anonymity Rating: 5 out of 5 stars5/5CompTIA Security+ Get Certified Get Ahead: SY0-701 Study Guide Rating: 5 out of 5 stars5/5How to Create Cpn Numbers the Right way: A Step by Step Guide to Creating cpn Numbers Legally Rating: 4 out of 5 stars4/5The Hacker Crackdown: Law and Disorder on the Electronic Frontier Rating: 4 out of 5 stars4/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Make Your PC Stable and Fast: What Microsoft Forgot to Tell You Rating: 4 out of 5 stars4/5
Reviews for Introduction to Unity
0 ratings0 reviews
Book preview
Introduction to Unity - John Bura
Introduction to Unity
by John Bura and Glauco Pires
Copyright
© 2017 Mammoth Interactive, Inc. All rights reserved.
ISBN 978-1-365-86929-7
Printed in Canada.
Published by Mammoth Interactive, Inc., 218 – 111 West Broadway, Vancouver, British Columbia, Canada V5Y 1P4.
Mammoth Interactive books may be purchased for educational, business, or sales promotional use.
Content Creators: John Bura and Glauco Pires
Transcriber/Editor: Alexandra Kropova
April 2017: First Edition
About the Author
When game enthusiast John Bura wanted to learn game development back in 2009, he could not find any classes to take. So he purchased a DVD set and learned that way. He learned how to build a game with an efficiency he had never seen in any of his university classes.
John felt compelled to share his new-found enthusiasm for this self-guided approach to learning. He founded Mammoth Interactive, with the goal that he would take online education to the next level. And so evolved Mammoth Interactive's holistic approach to teaching that did not just aim at someone who wanted to fine-tune their skills.
John's goal was to teach everyone, from your eight-year-old cousin to your eighty-year-old grandparent. Anyone can be a game developer. All that jargon can be replaced with practical, useful projects that students create alongside the instructor.
Since 2009, over 300,000 students have enrolled in Mammoth Interactive. And they love it. Go to www.mammothinteractive.com to get free stuff, courses, books, apps, games, t-shirts, daily deals, and more!
www.mammothinteractive.com
Introduction
In this book, you will learn how to use Unity and C# to create several games from scratch. The first part of this book is an introduction to Unity for those who have never used it before. Unity is the Number One free program for building virtual reality (VR) games.
In Pat One, we will create a 2D game where a player shoots a bullet at a wall to trigger an explosion. You will learn how to set up a scene, add objects, and change the appearance of your game in Unity. You will also learn how to import packages from the Asset Store.
In Part Two, we will create a 3D shooter game where a player enters a castle and attacks enemies. You will learn how to use the C# programming language to create scripts for your games. Thus you will be able to customize the behavior and appearance of your game objects.
By the end of this book, you will have practical games that you can show off in your portfolio. Ready to begin?
Part 1: Unity Editor 5
If you want to make a VR game, Unity is the program for you. The Unity engine comes with built-in models, materials, and more, which you can use to make your own 2D or 3D games.
Unity is the most popular platform for building VR games. You can build a variety of 2D and 3D games with its user-friendly interface.
In Part One, we will cover features of the Unity engine. We will look at 3D models, simple shapes like cubes and spheres. We will look at how to navigate throughout a scene, add shapes, and change appearances.
Chapter 1: Downloading Unity
To download Unity, visit www.unity3d.com. On the homepage, press the button Get Unity now
.
You will be taken to a page containing versions of Unity that you can download. The Personal version is free. You can publish games to the App Store with this version. Click on the Download Now
button in the Personal
bar.
Press Download Installer
, which will download the helper file UnityDownloaderAssistant
. Double-click the file, and open the Unity Download Assistant
file that appears.
Press the Open button from the pop-up that appears. Then press Continue
from the installation instructions. Read the terms of service, and press Continue and Agree
if you agree with them.
Then you will see options on which Unity components you wish to download. Ensure that the top three items are selected (Unity 5.4.3f1, Documentation, and Standard Assets). You can select additional components to install extra files.
Press Continue
. Once the files are installed, you can open Unity!
Chapter 2: Introduction to Unity
To make a new project in Unity, click on NEW
in the top right of Unity's start screen.
In the start screen, you can adjust some of the project's settings.
Give the project a name and location. The Location field refers to the folder in which you want to save the project. It is good practice to create a new folder just for your Unity projects so that you can easily find them.
Have the 3D rendering mode enabled. Press the Create Project
button. Unity will create a folder with the same name as your project name in the location you specified.
The Unity Editor will open. Your screen will look like the following:
The left sidebar is the Hierarchy window. This is like the hierarchy you have in your operating system. For example, in your Pictures folder, you may have sub-folders of events that group together photos.
The Hierarchy lists the names of the objects in the game's scene. Each object can have its own hierarchy. Currently, we have the items Main Camera and Directional Light, which are game objects. Anything that changes how a game works visually or internally, such as a player, enemy, or explosion, should be in a game object.
You can see the objects listed in the Hierarchy in the Scene window, which is the window in the center of your screen. The Scene displays the virtual world you build for a game.
Right-click in the Scene window. The cursor will change to an icon of an eye, as evident in the next image. While holding the right mouse button, you can move the cursor to look around the Scene.
Another way to navigate the Scene is to press the W, A, S, and D keys on your keyboard while holding the right mouse button. This is like the left, right, forward, and back arrow controls on a video game handheld.
Click on Main Camera
in the Hierarchy. Arrows will appear around the camera symbol in the Scene.
The Main Camera renders (draws) the game for the player. It can be thought of as a player. While Main Camera is selected, there is a Camera Preview box in the bottom right of the scene. The Camera Preview shows the scene from the perspective of a player.
To see the scene from a player's point of view, click on the Game
tab beside the Scene
tab. The Game window will open, as in the following screenshot.
Re-open the Scene window. Click on Directional Light
in the Hierarchy. Arrows will appear around the Directional Light's symbol in the Scene. The Directional Light emits light rays. You can change this game object to change the lighting of a scene.
The window to the right of the Scene contains the Inspector. This window shows details of a selected item, such as a game object in the Scene or a file in our project.
Click on Main Camera. The Inspector will fill with attributes of Main Camera that you can change. At the top is the name of the game object.
The Tag tab allows you to label the object. The Layer tab is not often changed for Main Camera because