Final Lecture 1
Final Lecture 1
Lecture 1
What is Unity?
● Unity is a powerful cross-platform game engine and a user-friendly development
environment that provides us with a complete set of tools we can use in our code
quickly and easily.
● Unity application programming interface (API) is filled with useful things such as
commonly used routines, data structures, and classes. These parts of the API are
often called a library.
● Rendering: Unity supports art assets and file formats from 3ds Max, Maya,
Blender, Adobe Photoshop and other graphics programs. These assets can be
added to the game project and managed through Unity's graphical user interface.
● Unity provides a complete set of tools to create characters and objects that your
code can interact with. These assets all live in the project directory as many
separate files or entities that you can control through code. 2
What is Unity?
● Unity provides scene files; 3D models; particle systems for explosions, fire, and
other special effects; and tools to create and edit all of these things.
● A game in Unity is made up of many different C# files. Each file can be referred to
as a “class” and end with the .cs file extension (which stands for C Sharp) and
named according to its purpose.
4
Creating a Project
● If you navigate to the place where you saved your project you will see a directory
with the name of your project and at least three main directories inside (Assets,
Library, and ProjectSettings).
● Assets: It is the root directory for the Unity editor “Project Panel” in which all C#
files, all the things you import, and any other game objects such as 3D models, 2D
textures, and sounds will be saved in this directory. If a file isn’t located in this
directory, your game will not be able to access it.
● ProjectSettings: This directory contains all the settings you have customized for
your project. So, for example, if you set the global gravity setting to be -20 instead
of -9.81, this change will be saved in a file called Physics2DSettings.asset.
5
Interface – Hierarchy Panel
● This window depends on the current scene you
have open, so its contents will look different for
different scenes.
8
Interface – Console Panel
● This view displays all the information that is being created by the C# code we
write.
Messages
Warnings
Errors
9
Interface – Inspector Panel
● This panel will display all the information of the
thing you currently have highlighted.
10
Interface – Scene View
● It is a window that is used to explore and edit the game world.
● We can move objects around to place them, scale them, rotate them, or even pan
your own view through the world.
11
Interface – Scene View
● The scene is more like a construction view of the
game that cannot be seen by the player, only you as
the creator of the game can access the scene view.
4 Scale Button
● Translate (Move) Button [W]: this allows to
reposition the selected object using the object’s axis 5 Rect Button
● Given that you are not able to see an object selected 5 Rect Button
in the Hierarchy in the Scene window, press the F
key to focus the Scene view on that object.
6 Transform Button 13
Interface – Game View
● The Game panel is the view of the game through the Main Camera.
● Unlike the Scene view, which allows you to explore the game world, the Game view
is a window that previews what the game would look like right now, if you were to
build the game.
14
Interface – Game View
● The Game view is controlled by the Play/Pause/Step
buttons along the top of the Editor.
● So, if you play the game and move things around, 1 Play Button
when you unclick PLAY button, things will revert to 2 Pause Button
their original positions.
3 Step Button
15
Game Object
● Game objects are all the “things” that constitute the scene.
● Game objects not only include concrete objects (e.g., a chair in a room), but also
other elements that reside in space such as light sources, audio sources, and
cameras.
● Every game object (even empty ones) has a position and orientation space. Thus,
it can be moved, rotated, and scaled.
● Game objects can be enabled or disabled where disabled objects behave as if they
do not exist.
16
Game Object
● To create a blank GameObject, RIGHT
CLICK in the Hierarchy panel and select
“Create Empty”. The object is created
in the Hierarchy named “GameObject”.
● The dropdown menu lists a number of standard tags defined in Unity, and you can
create new tags of your own.
● Tags describe a type of GameObjects which might be shared by many objects and
help in identifying GameObjects for scripting purposes.
18
Name and Tag
● For example, we might define “Player” tag for player-
controlled characters, an “Enemy” tag for non-player-
controlled characters, items that the player collect in
a Scene with a “Collectable” tag, etc.
19
Components
● Each game object is defined by a collection of associated elements that are called
components which depend on the nature of the object and define its behavior.
● Unity has several pre-defined components that handle rendering, physics, even
basic character controls.
● We can also define custom components, called scripts, which allow us to create
unique components that do a specific thing and control how the object behaves
and how it reacts to its environment.
● Components that are associated with a GameObject can be viewed and edited in the
Inspector window. 20
Transform Component
● Every GameObject has a component called Transform.
21
Adding/Removing Component
● Add Component button in the
Inspector panel is used to assign
components that are pre-defined in
the Unity Engine as well as any
custom scripts (C# files) written in
the project to an object in the scene.
23
THANK YOU