DES241
2020
Introduction to Unity (06/08/2020)
Mixed Reality
Remote Collaboration dSystem
Prasanth Sasikumar
Intro To Unity
Prasanth Sasikumar
Empathic Computing Lab
4
Games!
5
6
Unity editor
7
Unity Reel
https://youtu.be/QCqTn3SbfA0
8
Adam - Real Time Movie
https://www.youtube.com/watch?v=INbwoxfSBjQ
9
AR VR Games
https://www.youtube.com/watch?v=zNMlglRyRSo
Unity 3D features
● Cross platform
○ Windows, OSX, iOS, Android, Linux, WebGL, etc.
● Fast rapid development
○ Visual scene assembly, rapid prototyping
● Control over rendering pipeline
○ Access to low level graphics, shader programming
● Scripting in multiple coding languages
○ C#, C++, Javascript, etc.
● Asset store with thousands of contributions
○ Models, behaviours, programming tools, etc.
● Very large developer/support community 10
Unity 3D features
11
Download Unity
Download Unity - https://store.unity.com/
Pick version of Unity
12
Unity Business
13
Unity Basics
14
Unity Hub
● Install Unity Hub
○ Download Unity Hub – pick components you want
○ https://unity3d.com/get-unity/download
15
Getting Started
● First time running Unity you’ll be asked to create a
project
● Pick 3D, specify project name and location
Getting Started
16
Unity Interface
17
Customizable Interface
18
Unity Interface
Scene View
● Where the game is constructed
● Visually place all the assets
○ models, cameras, other pieces that
make up the game
19
Unity Interface
Hierarchy Window
● List of all current GameObjects being
used in the application
● GameObjects can be nested
● Can have multiple scenes
20
Unity Interface
Project Window
● Contains at the assets needed for
application
● Drag assets into the hierarchy
window
21
Unity Interface
Inspector View
● Configure any GameObject
• Change properties
• Add components
Building Scenes
● Use GameObjects:
○ Containers that hold different components, Eg 3D model, texture, animation
● Use Inspector
○ View and edit object properties and other settings
● Use Scene View
○ Position objects, camera, lights, other GameObjects etc
● Scripting
○ Adding interaction, user input, events, etc
22
Unity 3D features
23
Getting Started
● Every object in Scene is a GameObject
● GameObjects contain Components
• e.g. Transform Component, Camera Component
GameObjects
24
Getting Started
Adding 3D Content
● Create 3D asset using modeling package, or download
○ Fbx, Obj file format for 3D models
● Add file to Assets folder in Project
● Or drag the file into Project View
● Drag mesh from Project View into Hierarchy or Scene View
○ Creates a game object
25
Getting Started
Positioning/Scaling Objects
● Click on object and choose transform
26
Getting Started
Manipulating Objects and Camera
● Panning and scaling
27
Getting Started
Unity Coordinate Frame
● Left handed coordinate system.
● Select axes to translate object
28
Getting Started
Rotation About Axes
● Use rotation tool, select rotation line
29
Unity Asset Store
● Download thousands of models, scripts, animations, etc
● https://assetstore.unity.com/
30
Unity Asset Store
31
Unity Simple Scene
Making a Simple Scene
1. Create New Project
2. Create Game Object
3. Moving main camera position
4. Adding lights
5. Adding more objects
6. Adding physics
7. Changing object materials
8. Adding script behaviour
32
Making a Simple Scene
33
Making a Simple Scene
● Create new folder and project
Create Project
34
Making a Simple Scene
● Load a Sphere into the scene
● GameObject -> 3D Object -> Sphere
Create GameObject
35
Making a Simple Scene
● Select Main Camera
● Select translate icon
● Move camera
Moving main camera
36
Making a Simple Scene
● GameObject -> Light -> Directional Light
● Use inspector to modify light properties (colour, intensity)
Add Light
37
Making a Simple Scene
● Select Sphere
● Add Rigidbody component
● Add Component -> Physics -> RigidBody or Component -
> Physics -> RigidBody
● Modify inspector properties (mass, drag, etc)
Add Physics
38
Making a Simple Scene
● Add several cubes
● GameObject -> 3D Object – Cube
● Move cube
● Add Rigid Body component (uncheck gravity)
Add More Objects
39
Making a Simple Scene
● Assets -> Create -> Material
● Click Albedo colour box in inspector
● Select colour
● Drag asset onto object to apply
Add Material
40
Making a Simple Scene
● Assets -> Create -> C# script
● Edit script using Mono/Visual Studio
● Drag script onto Game Object
Add Script
41
Making a Simple Scene
● GameObject Rotation
Example C# Script
using UnityEngine;
using System.Collections;
public class NewBehaviourScript: MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
this.gameObject.transform.Rotate(Vector3.up*10);
}
}
Scripting C# Unity 3D
● void Awake():
○ Is called when the first scene is loaded and the gameobject is active
● void Start():
○ Called on first frame update
● void FixedUpdate():
○ Called before physics calculations are made
● void Update():
○ Called every frame before rendering
● void LateUpdate():
○ Once per frame after update finished
42
Unity 3D features
43
Making a Simple Scene
● Placement
44
Making a Simple Scene
● Final Spinning Cube Scene
Resources
● Unity Main site
○ https://unity.com/
● Vuforia
○ https://library.vuforia.com/getting-started/overview.html
● Official Unity Tutorials
○ https://learn.unity.com/
● Unity Coder Blog
○ http://unitycoder.com
45
Unity 3D Resources
DES241
2020
Prasanth Sasikumar
psas598@aucklanduni.ac.nz

Introduction to Unity