Presentation is loading. Please wait.

Presentation is loading. Please wait.

INTRO TO UNITY Building your first 3D game. DISCLAIMER  “This website is not affiliated with, maintained, endorsed or sponsored by Unity Technologies.

Similar presentations


Presentation on theme: "INTRO TO UNITY Building your first 3D game. DISCLAIMER  “This website is not affiliated with, maintained, endorsed or sponsored by Unity Technologies."— Presentation transcript:

1 INTRO TO UNITY Building your first 3D game

2 DISCLAIMER  “This website is not affiliated with, maintained, endorsed or sponsored by Unity Technologies or any of its affiliates. This is an independent, unofficial site. UNITY, UNITY3D and the Unity box logo are trademarks of Unity Technologies ApS.”

3 WHAT UNITY IS 2D / 3D Rendering Engine Development Environment Physics Game Engine

4 MOBILE MARKET

5 USES  Games  Mobile  PC  Console (Xbox/PS/Wii)  Web  Business Apps  Cross Platform  Nice visual effects  Visualization (medical, architectural, etc.)  Augmented Reality (Hololens)  Virtual Reality

6 NEW PROJECT  Open Unity  Create a new Project  Named “3D Intro”

7 PLANE & CUBE Add a Plane GameObject->Create New->Plane Add a Cube GameObject->Create New->Box Will be hard to see

8 MOVE CUBE Set Cubes Y position to 0.5

9 SAVE SCENE Create a Scenes Folder Right click->Create Folder Save Scene File->Save Scene As Named “1. Box on Plane”

10 MATERIALS FOLDER & MATERIAL Create a Materials Folder Right Click Create->Material Name it “Blue”

11 CHANGE MATERIAL COLOR & ASSIGN Set the Material Color to a Blue of your choice Drag the Material from the Project View to the Cube in the Scene View

12 SET THE PLANE TO NAVIGATION STATIC Select the Plane Click the Static Dropdown and select Navigation Static

13 BAKE A NAVMESH Select Window -> Navigation Set Agent Radius to 0.05 At the BOTTOM of the navigation tab, click Bake

14 SAVE SCENE Save the Scene Name it “2. Blue Box with NavMesh”

15 RENAME CUBE Select the “Cube” in the Hierarchy Rename it to “BlueBox” in the Inspector

16 ADD NAVMESHAGENT With the BlueBox selected, click “Add Component” Type navmesh to filter Select the “Nav Mesh Agent”

17 IMPORT THE BOXCODE.UNITYPACKAGE Double click the BoxCode.UnityPackage file to import it

18 ASSIGN THE BOXNAVIGATOR SCRIPT Select the BlueBox Add Component -> BoxNavigator

19 PLAY AND TEST Click Play Click the Plane Watch the Box move

20 CODE INVESTIGATION Let’s go over the BoxNavigator

21 MOVE THE SCENE VIEW Hold Right Mouse Use WASD to move around Adjust to be looking at the box from above

22 ALIGN THE CAMERA Select the Main Camera GameObject->Align With View Or use the HotKey

23 NEW CAMERA VIEW / TOP DOWN Game View should look like this

24 MOVE THE BOX Adjust the X or Z position of your BlueBox so that it’s to the Right side of the screen

25 SAVE THE SCENE File->Save Scene As Name it “3. Camera view and Navigation”

26 CREATE ANOTHER CUBE GameObject ->3D Object -> Cube Adjust the Y & Z positions Or X position if Z is wrong

27 CREATE RED MATERIAL Open Materials Folder in Project View Right Click Create->Material Name it “Red”

28 SELECT A TINT OF RED Select the “Red” material In the Inspector, choose a tint of Red

29 ASSIGN THE RED MATERIAL Select the new Cube In the Inspector, expand the Materials section Click the Circle (in yellow)

30 USE THE MATERIAL SELECTOR Use the Selector to choose the “Red” material from our Assets

31 GAME VIEW Your Game View should look like this

32 ADD REDBOX SCRIPT TO THE CUBE Select the Cube Add Component Search for RedBox

33 RENAME CUBE TO REDBOX Rename the Cube by hitting F2 or using the Inspector

34 CREATE PREFABS FOLDER Create->Folder Name it “Prefabs”

35 CREATE A PREFAB Drag the Redbox from the Hierarchy to the Prefabs folder Drag Bluebox from the Hierarchy to the Prefabs folder They should both turn BLUE in the Hierarchy

36 CREATE AMMO GameObject->3D Object- >Sphere

37 RENAME IT TO AMMO Rename the Sphere to “Ammo”

38 ADD RIGIDBODY TO AMMO Add Component Search for RigidBody DO NOT ADD THE 2D VERSION

39 CHANGE AMMO POSITION AND SCALE Set the Ammo Scale t0 0.5 for X, Y, & Z Set the Position to 0.0 for X, Y, & Z

40 CREATE THE AMMO PREFAB Drag the Ammo from Hierarchy to the Prefabs folder

41 ASSIGN THE AMMO TO THE REDBOX SCRIPT Select the RedBox Drag the Ammo from Prefabs to the RedBox DO NOT SINGLE CLICK AMMO MUST HOLD MOUSE BUTTON DOWN

42 ASSIGN BOXSPLITTER TO BLUEBOX Add Component Find BoxSplitter Add it

43 LAYERS Click on Layers Hit Add Layer

44 ADD 3 NEW LAYERS Create the Layers “Red” “RedWeapon” “Ground”

45 OPEN PHYSICS SETTINGS Edit -> Project Settings -> Physics

46 UNCHECK REDWEAPON INTERACTIONS Uncheck RedWeapons interaction with “Red” and other “RedWeapons”

47 SAVE PROJECT This will save your physics and layers

48 SET REDBOX TO RED LAYER Set the Layer to Red using the Dropdown

49 SET AMMO LAYER TO REDWEAPON Select RedWeapon in the Layer Dropdown

50 APPLY AMMO CHANGES Click Apply to propagate the changes to the Ammo Prefab If not available, you already selected the prefab and don’t need to do anything

51 SAVE SCENE! Save Again…

52 PLAY Hit play and check it out

53 CODE TIME Let’s look at the RedBox code

54 ADJUST FIRESPEED Select the RedBox Adjust FireSpeed to 100

55 PLAY See how fast it shoots

56 DISABLE REDBOX SCRIPT Uncheck the Box by the name to disable the component Now it won’t shoot!

57 ADD RIGIDBODY TO BLUEBOX & SET MASS Add a RigidBody to the BlueBox Set the Mass to 100

58 PLAY Push the Red Box Off!

59 DUPLICATE BLUEBOX PREFAB Right Click and Select Duplicate on BlueBox

60 RENAME BLUEBOX DUPLICATE Rename the Duplicate to “BlueBox Split Once” Set Scale to 0.5 for X, Y, & Z

61 ASSIGN THE SPLIT ONCE BOX Select “BlueBox” Assign the BlueBox Split Once to the Split Into Prefab section Click & Drag DO NOT SINGLE CLICK

62 ENABLE REDBOX SCRIPT Select the RedBox Enable the Script we previously disabled

63 PLAY Watch the Split Try to push off the Red Cube

64 CREATE A YELLOW MATERIAL Create a new Material Named “Yellow” Pick a shade of yellow

65 CREATE A NEW CUBE SET POSITION & SCALE Create a new Cube GameObject -> 3D -> Cube Set the position to 0, 0, 0 Set the Scale X value to 4

66 RENAME TO OBSTACLE AND SET NAVIGATION STATIC Rename the Cube Select Navigation Static

67 ADD A NAV MESH OBSTACLE Select your new Cube and Add a Nav Mesh Obstacle

68 BAKE NAV MESH Window -> Nav Mesh Bake Tab Click Bake

69 PLAY Can’t go through the cube..

70 MEETUP.UNITY3D.COLLEGE Asset Store Giveaway!


Download ppt "INTRO TO UNITY Building your first 3D game. DISCLAIMER  “This website is not affiliated with, maintained, endorsed or sponsored by Unity Technologies."

Similar presentations


Ads by Google