Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Introduction to UnityFor Unity 3.5Petri Lankoski, petri.lankoski@sh.se
New Project     File -> New Project…     Set name and directory      where you want to store the      project     Selec...
Importing a Package     Download:        If you have free version:            http://www.mediafire.com/file/2bdmrn5j4vc...
Anatomy of Unity GUI Project Frame contains assets and scripts • We got these from packages • These are your tools to buil...
Anatomy of Unity GUI                                       Scene & Hierarchy views                                       •...
Building a scene         Delete Main CameraPetri Lankoski, petri.lankoski@sh.se
Adding a PlainPetri Lankoski, petri.lankoski@sh.se
Anatomy of Unity GUIInspector• Shows details of the   selected objectPetri Lankoski, petri.lankoski@sh.se
Modifying the Plain                                                         Change X and                                  ...
Navigating in UnityMove tool (shortcut: W)                                              Play Mode                Rotate to...
Save a Scene     File -> Save Scene        Name it “First”            Or something elsePetri Lankoski, petri.lankoski@s...
Player & Light Source       Drag-and-drop       PlayerPetri Lankoski, petri.lankoski@sh.se
Directional Light  Move by                              Rotate by  Drag from                            Drag from  An arro...
Player Prefab                                       Make sure                                       that                  ...
Adding Manager                                        Rename the empty object                                         as ...
Time to Test                                       Hit PlayPetri Lankoski, petri.lankoski@sh.se
Adding Waypoints for an    Enemy                                       Drag and drop                                      ...
Grouping Objects in Hierarchy             Rename waypoints          Grouping ObjectPetri Lankoski, petri.lankoski@sh.se
Connecting Waypoints                                       1. Drag and                                          drop      ...
Connecting Waypoints                Drag-and-                drop EnemyPetri Lankoski, petri.lankoski@sh.se
Adding an Enemy           Drag-and-drop           Waypoint1 Target (on           Enemy)Petri Lankoski, petri.lankoski@sh.se
Time to TestPetri Lankoski, petri.lankoski@sh.se
Adding Things     Walls:        Hierarchy: Create ->         Cube        Scale & Rotate & Move     More complex object...
New Objects from Maya     Create an object in Maya        Save (ma/mb)            Maya needed on the machine running Un...
New Textures     Create a texture in Photoshop        Preferred size: n2 x m2        Default max size of a texture: 102...
Renderer & Materials     An object has renderer        Renderer draws the object to the screen        Renderer has one ...
Material                                       Shader                                       This part                     ...
Prefabs                                       In Escape PackagePetri Lankoski, petri.lankoski@sh.se
Checkbox for                                       Enabling/disabling    Enemy                              scripts       ...
Colliders & Collision                                          STATIC                                 STATIC              ...
Colliders & Collision                                          STATIC                                 STATIC              ...
Enemy                                       Fine-tune how this                                       enemy perceivesPetri ...
Enemy                                       Tag is used with                                       waypoints              ...
Enemy Components /    Billboard                                       Enemy consists                                      ...
Enemy Components / LightPetri Lankoski, petri.lankoski@sh.se
Waypoints                                       This should match                                       to Tag of an      ...
Door                                       Player reached                                       the end if this is        ...
Door                                       The name of level                                       where the door         ...
Door with LockPetri Lankoski, petri.lankoski@sh.se
Player Start Waypoint     Player object only to the first      level     In levels 1-        Place PlayerStart where   ...
Scenes (levels)     Level 0        Splash screen        Very minimal to     Levels 1+        Actual game levelsPetri ...
Setting up Start Screen     File -> New Scene     Download package:        http://dl.dropbox.com/u/1380179/escape_mainm...
Escape Splash Screen                                 Drag-and-drop                                                 Draws t...
Setting up Start Screen                                       Write the                                       name of     ...
GUI Skin                                       Changes how                                       buttons and              ...
Start ScreenPetri Lankoski, petri.lankoski@sh.se
Build Game                                       Select:                                       • File -> Build Settings…  ...
Upcoming SlideShare
Loading in …5
×

Introduction to Unity

3,313 views

Published on

My teaching materials for introducing Unity. There are related Unity Packages containing prefabs, assets, and scrips used. Updated slides 2013/01/07 to reflect the location of the packages.

  • Be the first to comment

Introduction to Unity

  1. 1. Introduction to UnityFor Unity 3.5Petri Lankoski, petri.lankoski@sh.se
  2. 2. New Project  File -> New Project…  Set name and directory where you want to store the project  Select  Image Effect (ONLY IF YOU HAVE Pro)  Toon ShadingPetri Lankoski, petri.lankoski@sh.se
  3. 3. Importing a Package  Download:  If you have free version:  http://www.mediafire.com/file/2bdmrn5j4vcikpa/ escape_stripped.unitypackage.zip  If you have Pro  http://www.mediafire.com/file/y5i38txo42fj8i3/esc ape.unitypackage.zip  Unzip the downloaded file  Assets -> Import Package -> Custom Package…  Select the downloaded packagePetri Lankoski, petri.lankoski@sh.se
  4. 4. Anatomy of Unity GUI Project Frame contains assets and scripts • We got these from packages • These are your tools to build the gamePetri Lankoski, petri.lankoski@sh.se
  5. 5. Anatomy of Unity GUI Scene & Hierarchy views • View to your level (game) • For building a levelPetri Lankoski, petri.lankoski@sh.se
  6. 6. Building a scene Delete Main CameraPetri Lankoski, petri.lankoski@sh.se
  7. 7. Adding a PlainPetri Lankoski, petri.lankoski@sh.se
  8. 8. Anatomy of Unity GUIInspector• Shows details of the selected objectPetri Lankoski, petri.lankoski@sh.se
  9. 9. Modifying the Plain Change X and These should be Z to 20 0 • Experiment to find suitable scale • Y should be Drag-and-drop 1 ground to plainPetri Lankoski, petri.lankoski@sh.se
  10. 10. Navigating in UnityMove tool (shortcut: W) Play Mode Rotate tool (shortcut: E) Scale tool (shortcut: R) Hand tool (shortcut: Q) On scene view: - click-drag to move camera • F to zoom to selected - ALT click-drag to orbit object camera around • Hold right mouse to enable - CTR click-drag to zoom • ASWD movementPetri Lankoski, petri.lankoski@sh.se • Q up, E down
  11. 11. Save a Scene  File -> Save Scene  Name it “First”  Or something elsePetri Lankoski, petri.lankoski@sh.se
  12. 12. Player & Light Source Drag-and-drop PlayerPetri Lankoski, petri.lankoski@sh.se
  13. 13. Directional Light Move by Rotate by Drag from Drag from An arrow The spherePetri Lankoski, petri.lankoski@sh.se
  14. 14. Player Prefab Make sure that Object is on the plain • Set to 0,0,0 Drag up until the object is totally visiblePetri Lankoski, petri.lankoski@sh.se
  15. 15. Adding Manager  Rename the empty object as GameManager  Drag-and-drop GameAgents on GameManagerPetri Lankoski, petri.lankoski@sh.se
  16. 16. Time to Test Hit PlayPetri Lankoski, petri.lankoski@sh.se
  17. 17. Adding Waypoints for an Enemy Drag and drop four Waypoint to scene • Place them to corners (as in Figure) • Make sure that Waypoints are on top of the plainPetri Lankoski, petri.lankoski@sh.se
  18. 18. Grouping Objects in Hierarchy Rename waypoints Grouping ObjectPetri Lankoski, petri.lankoski@sh.se
  19. 19. Connecting Waypoints 1. Drag and drop Waypoint2 to NextTarget on Waypoint1 2. Drag and drop Waypoint3 to NextTarget on Waypoint2 3. …Petri Lankoski, petri.lankoski@sh.se
  20. 20. Connecting Waypoints Drag-and- drop EnemyPetri Lankoski, petri.lankoski@sh.se
  21. 21. Adding an Enemy Drag-and-drop Waypoint1 Target (on Enemy)Petri Lankoski, petri.lankoski@sh.se
  22. 22. Time to TestPetri Lankoski, petri.lankoski@sh.se
  23. 23. Adding Things  Walls:  Hierarchy: Create -> Cube  Scale & Rotate & Move  More complex objects are modeled in separate software.Petri Lankoski, petri.lankoski@sh.se
  24. 24. New Objects from Maya  Create an object in Maya  Save (ma/mb)  Maya needed on the machine running Unity  Export FBX  Move the model to Assets folder  Set import scale  Do not use Transform – Scale on Inspector with imported models to change the default scalePetri Lankoski, petri.lankoski@sh.se
  25. 25. New Textures  Create a texture in Photoshop  Preferred size: n2 x m2  Default max size of a texture: 1024x1024  Bigger textures consumes more memory  Use psd or tiff formata  Keep layers  Save it to Assets folder  Open UnityPetri Lankoski, petri.lankoski@sh.se
  26. 26. Renderer & Materials  An object has renderer  Renderer draws the object to the screen  Renderer has one or materials  Materials consists of  Shader  Resources that the shader needs for rendering  E.g., textures, colors, other assets  Multiple objects can share a material  If the material is changed, the rendering of all objects having that material is changed.Petri Lankoski, petri.lankoski@sh.se
  27. 27. Material Shader This part changes based on the selected shader PreviewPetri Lankoski, petri.lankoski@sh.se
  28. 28. Prefabs In Escape PackagePetri Lankoski, petri.lankoski@sh.se
  29. 29. Checkbox for Enabling/disabling Enemy scripts Collider • For moving objects Plays sounds Enemy logic • Movement speed • Damage dealt • Sound filesPetri Lankoski, petri.lankoski@sh.se
  30. 30. Colliders & Collision STATIC STATIC STATICPetri Lankoski, petri.lankoski@sh.se
  31. 31. Colliders & Collision STATIC STATIC STATICPetri Lankoski, petri.lankoski@sh.se
  32. 32. Enemy Fine-tune how this enemy perceivesPetri Lankoski, petri.lankoski@sh.se
  33. 33. Enemy Tag is used with waypoints • Different tags ensure that enemies keep their tracksPetri Lankoski, petri.lankoski@sh.se
  34. 34. Enemy Components / Billboard Enemy consists of multiple billboards • Texture animation • Textures • Animations speedPetri Lankoski, petri.lankoski@sh.se
  35. 35. Enemy Components / LightPetri Lankoski, petri.lankoski@sh.se
  36. 36. Waypoints This should match to Tag of an enemy • Default ok if you do not have crossing tracks Waypoint has a collider • Place it so that an enemy canPetri Lankoski, petri.lankoski@sh.se collide with it
  37. 37. Door Player reached the end if this is checked These controls how completing the game is shownPetri Lankoski, petri.lankoski@sh.se
  38. 38. Door The name of level where the door leads • If multiple names areLevels needs to be provided, onein Scenes in Build! is selected randomlyPetri Lankoski, petri.lankoski@sh.se
  39. 39. Door with LockPetri Lankoski, petri.lankoski@sh.se
  40. 40. Player Start Waypoint  Player object only to the first level  In levels 1-  Place PlayerStart where the player object beginsPetri Lankoski, petri.lankoski@sh.se
  41. 41. Scenes (levels)  Level 0  Splash screen  Very minimal to  Levels 1+  Actual game levelsPetri Lankoski, petri.lankoski@sh.se
  42. 42. Setting up Start Screen  File -> New Scene  Download package:  http://dl.dropbox.com/u/1380179/escape_mainmen u.unitypackage  Assets -> Import Package -> Custom Package…  Select escape_mainmenu.unitypackage  Add Player prefab to scene  This is the only level where Player should be!  You can add the Player for testing  Remove after level is readyPetri Lankoski, petri.lankoski@sh.se
  43. 43. Escape Splash Screen Drag-and-drop Draws the GUIPetri Lankoski, petri.lankoski@sh.se
  44. 44. Setting up Start Screen Write the name of your first levelPetri Lankoski, petri.lankoski@sh.se
  45. 45. GUI Skin Changes how buttons and labels look likePetri Lankoski, petri.lankoski@sh.se
  46. 46. Start ScreenPetri Lankoski, petri.lankoski@sh.se
  47. 47. Build Game Select: • File -> Build Settings… Select target and build Alternatively: • File -> Build Settings…Petri Lankoski, petri.lankoski@sh.se

×