#Intro To Unity Author(s): Nathalie Goh-Livorness || aka.ms/nathalie || @stopNgoh All downloadable assets and content can be found here: http://unity3d.com/learn/tutorials/projects/survival-shooter
Objective This lab goes through using the Unity Game engine to build and ship your first game to Windows.
By the end of this lab you will be able to:
- Understand the Unity interface
- Set up a 3d environment in Unity
- Build and run your game to all platforms
- SETTING UP THE ENVIRONMENT
- ADDING THE PLAYER CHARACTER
- SETTING UP THE CAMERA
- ADDING THE FIRST ENEMY
Requirements
- Visual Studio for Unity - https://visualstudiogallery.msdn.microsoft.com/20b80b8c-659b-45ef-96c1-437828fe7cf2
- Unity 4.5.5 or higher - https://unity3d.com/unity/download
Setup Screenshot of VS plug in for Unity #Environment
- Setup Editor Layout 2 by 3
- Drag Project tab below the Hierarchy
- Set view slider to minimum on Project panel
- File -> New Scene
- File -> Save Scene As, name it Level 01 in Scenes folder
- Locate Environment prefab in the Project panel Prefabs folder
- Drag into Scene or Hierarchy
- Ensure it is at Position (0,0,0) in Transform
- Repeat 1-3 for the Lights prefab
- Save your scene (CMD-S / CTRL-S)
- GameObject menu -> 3D Object -> Quad
- Rename to Floor
- Ensure it is at Position (0, 0, 0) in Transform
- Set Rotation (90, 0, 0) in Transform
- Set Scale to (100, 100, 1) in Transform
- Remove Mesh Renderer Component from the Floor game object
- Set the Floor game object to use the Floor layer at the top of the Inspector panel
- Save your Scene (CMD-S / CTRL-S)
- Game Object -> Create Empty
- Rename GameObject to BackgroundMusic
- Add Component -> Audio -> Audio Source
- Audio Clip -> Circle Select -> Background Music
- Check Loop and set Volume to 0.1
- Save your Scene (CMD-S / CTRL-S) #End of Phase One! #Player Character
- Locate the Player model in Models -> Characters folder of the Project panel
- Drag it into the Scene or Hierarchy panels
- Set the Position to (0, 0, 0) in Transform
- Set the Tag to Player in the drop-down in Inspector
- Select the Animation folder and click Create on the Project panel, choose Animator Controller
- Name this new asset PlayerAC
- Drag and drop it onto the Player in the Hierarchy
- Double-click PlayerAC asset in Project -> Animation
- Dock the Animator window by the Scene view
- Expand the Player model in Models -> Characters
- Drag the Idle, Move and Death animations to empty space in the Animator window to create states
- Right-click Idle state and choose Set as Default
- Create a bool parameter named IsWalking
- Create a Trigger parameter named Die
- Right-click Idle and Make Transition to move
- Select the Transition arrow you made
- Set the condition for this to Iswalking = true
- Right-click Move and Make Transition to Idle
- Set the Condition for this to IsWalking = false
- Right-click ‘Any State’ and Make Transition to Death
- Set the Condition for this to Die (trigger)
- Select Player game object, component -> Physics -> Rigidbody
- Set Drag & Angular Drag to Infinity
- Expand the Constraints, Freeze the Y Position and Freeze the X and Z Rotations
- Select Player game object, Add Component -> Physics -> Capsule Collider
- Set Center to (0.2, 0.6, 0)
- Set Height to 1.2
- Add Component -> Audio -> Audio Source
- Audio Clip -> Circle Select Player Hurt
- Uncheck Play On Awake
- Locate PlayerMovement script in Scripts -> Player
- Drag & Drop this to Player game object in Hierarchy
- Save your Scene (CMD-S / CTRL-S)
- Double-click the icon of the PlayerMovement script to open it in the Script editor