Unity Lesson 1

Today’s Lesson

Download Unity

Download lesson unity project

unzip the file, open the Assets folder, and double click “_lesson1″

open_lesson_scene

Why Unity?

Make game once, run on any device (web browser, phones, mac, windows, linux)
Lot’s of useful built in stuff  (physics, particles, rag-dolls, shaders, cloth)

Caveats: Extremely quirky for 2D, certain tasks bizarrely obfuscated

The interface

Official documentation

Moving around in the scene view:

How to move around the scene (official documentation)

Cheat Sheet

Mac Book

option click

rotate around selected object

2 finger scroll

zoom in and out

option+command+click

move lateral to camera

hold 2-finger click + WASD/QE keys

“flythrough”

3-button mouse users

alt/option click

rotate around selected object

scroll wheel

zoom in and out

Click the scroll wheel

move lateral to camera

hold right click  + WASD/QE keys

“flythrough”

 

Tip: Double clicking an object in the hierarchy takes you to it, and zooms in on it.

Creating game objects

For today, we’ll just work with cubes,spheres, etc…  To create a cube,sphere, etc… in your scene, go to GameObject/Create/Other/Cube (or whatever)

creating_primitives

Moving/Rotating/Scaling Objects in the Scene view

Official howto

TIP: If you hover over X,Y, or Z in the inspector, you can click and drag to change the value.  
moving tip

You can also of course type in specific values.  For example, you might want to ensure all your objects are lined up along the z dimension by setting all their positions to 0.

Using the inspector to move/rotate/scale

Physics

Official Unity physics overview

To make a game object physically simulated (fall with gravity, slide along the floor, etc…) you need to add a ‘rigid body’ component.

add_rigid_body

More info about the rigid body component

BONUS: Check out physics materialshingessprings

Running your game

Hit the play button,

play_button

And see your game run in the ‘game’ window

game_window

Scripts

Like rigid bodies, scripts are components, and are always attached to a game object.  To attach an existing script to a game object, simply locate it in the project tab, and drag it onto an object in the hierarchy.  Let’s try putting the ‘Blastoff’ script on one the objects in our scene.

Mesh Creator

Official Documentation

Link to Unity Assignment 2