Uploaded by Zohaib Shahjehan

GDD-LAB#2

advertisement
UNIVERSITY OF MANAGEMENT AND TECHNOLOGY
Lab Manual# 2
Getting started with Unity 3D
Course Instructor
Khawaja Ubaid ur Rehman
Department of Computer Science
School of Systems and Technology
UMT Lahore
Objectives

The purpose of this manual is to get started with Unity 3D. To learn how to create a
terrain, mountains and track, trees and character.
Pre-requisites

Lab 1
1. Create a new project in Unity using Unity hub.
1.
2.
3.
4.
Select Unity version from drop down list
Select template
Write your project name
Set the desire location where you want to save your project.
1
2
3
4
2. Unity will create a Sample scene as shown in screen shot.
3. Create a 3D object terrain as shown in screen shot.
4. Terrain has tool set through which can create neighbor terrains. Select
Neighbor Terrain tool and click on the yellow area to create terrains in
surroundings.
GameObject: Every object in your game is a GameObject, from characters and collectible items
to lights, cameras and special effects. However, a GameObject can’t do anything on its own; you
need to give it properties before it can become a character, an environment, or a special effect.
GameObjects are the fundamental objects in Unity that represent characters, props and scenery.
They do not accomplish much in themselves but they act as containers for Components, which
implement the functionality.
Collision
Unity handles collision between GameObjects with colliders, which attach to GameObjects and
define the shape of a GameObject for the purposes of physical collisions. A collider is invisible,
and does not need to be the exact same shape as the GameObject’s mesh. A rough approximation
of the mesh is often more efficient and indistinguishable in gameplay.
The simplest (and least processor-intensive) colliders are primitive collider types. In 3D, these are
the Box Collider, Sphere Collider and Capsule Collider. In 2D, you can use the Box Collider
2D and Circle Collider 2D. You can add any number of these to a single GameObject to
create compound colliders.
5. To add mountains select Paint Terrain tool and select Raise and Lower Terrain
option from drop down list.
6. Select any brush from brushes. Choose the brush size and opacity and create
mountains by doing sculpting on terrain.
7. To paint your terrain, mountains, add grass and trees etc. download an asset
“Standard assets” from Unity asset store. To download any asset first Sign in to
your Unity account as shown in screen shot.
7a. Type Unity asset store in google search bar and open Unity asset store in
your browser.
7b. Click on Sign in button as shown in screen shot.
7c. Select Google or Facebook account.
7d. After sign in, search for standard assets and then click on Open in Unity
button.
7e. Tick the checkbox and then click on Open in Unity hub.
8. When Package Manager screen opens then select My assets option and
search for standard assets. Click on download and then import it.
8a. If this error as shown in Unity Asset store occurs, then simply close Unity
and start Unity again.
9. Fix the GUIText error by clicking on error and then simply add the namespace
of UnityEngine.UI and replace GUIText with Text data type as shown in screen
shot. Save your script by pressing Ctrl+S.
10. Select Paint texture tool and click on Edit Terrain Layers. Add 2 different layers
GrassRocky and GrassHill.
11. Create a track by selecting Paint texture tool, layer and set brush size. Now
simply create a design on terrain.
Lab Tasks
1. Add 2 trees named as conifer and palm and then select any tree from them and
place 1000 random trees on the terrain.
2. Add a Third person character controller without AI to your scene.
Download