0% found this document useful (0 votes)
2 views20 pages

GameDev Unity Notes

The document provides an overview of game development using Unity, covering essential concepts such as the definition of game development, the role of game engines, and the Unity interface. It details the components that make up a game, including GameObjects, scripting, physics, and collision detection. Additionally, it introduces the concept of prefabs for creating reusable GameObject templates within Unity.

Uploaded by

tanmoyshende1999
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views20 pages

GameDev Unity Notes

The document provides an overview of game development using Unity, covering essential concepts such as the definition of game development, the role of game engines, and the Unity interface. It details the components that make up a game, including GameObjects, scripting, physics, and collision detection. Additionally, it introduces the concept of prefabs for creating reusable GameObject templates within Unity.

Uploaded by

tanmoyshende1999
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Contents

1. What Is Game Development? 2

2. Understanding a Game Engine 4

3. The Unity Interface 6

4. GameObjects & Components 8

5. The Game Loop & Scripting 11

6. Physics & Collision 14

7. Prefabs 17

8. Player Movement Script 19

9. Quick Reference 22

Game Development with Unity — Student Notes Page 1


Chapter 1

What Is Game Development?


Understanding games, the people who make them, and why it matters.

Game development is the process of designing, building, and refining interactive experiences — from a simple
2D mobile game to a full 3D virtual reality world. It combines art, programming, sound design, and game design
into a single creative discipline.

1.1 What Makes Something a Game?


Not everything interactive is a game. A game has four essential ingredients that work together to create an
experience the player actively participates in.

Rules Define what the player can and cannot do. No rules = no game. Chess has
100+ rules; Pong has 3.

Goal A clear objective — reach the end, score the most, survive the longest.
Without a goal, it is a toy, not a game.

Feedback The game communicates what happened — a score ticks up, a character
flashes red, a sound plays. Feedback closes the loop between action and
result.

Player Agency The player's choices must actually matter. If nothing you do changes the
outcome, you are watching, not playing.

REAL WORLD EXAMPLE

BGMI: Rules (100 players, shrinking zone), Goal (be last alive), Feedback (kill feed, zone damage indicators),
Agency (where you land, how you move, what weapon you pick up). All four ingredients, working together.

1.2 Game Genres


Games are typically grouped by how the player interacts with them, not just how they look.

• 2D Platformer — side-scrolling, jump-based (Super Mario, Hollow Knight)


• 2D Arcade — score-chasing, simple rules (Flappy Bird, Pac-Man)
• 3D Action / Adventure — exploration and combat in a 3D space (GTA, Zelda)
• First-Person Shooter (FPS) — camera from the player's eyes (BGMI, Valorant)
• Virtual Reality (VR) — fully immersive, player inside the game world
• Augmented Reality (AR) — virtual objects overlaid on the real world (Pokémon GO)

Game Development with Unity — Student Notes Page 2


1.3 Who Makes Games?
A professional game studio has many roles. As a student, you will touch most of these yourself.

• Game Designer — defines the rules, mechanics, and player experience


• Programmer / Developer — writes the code that makes the game run
• 3D Artist — creates characters, environments, and props
• Animator — brings characters and objects to life with movement
• Sound Designer — creates music, sound effects, and ambient audio
• QA Tester — plays the game to find and report bugs

TIP

Minecraft was built by one developer (Markus Persson). Among Us was built by a team of three. Flappy Bird was
made by one person over a few days. Small teams can make huge games with the right tools.

Game Development with Unity — Student Notes Page 3


Chapter 2

Understanding a Game Engine


What a game engine is, what it gives you, and which ones exist.

A game engine is a software framework that provides the core tools and systems needed to build a game.
Instead of writing physics from scratch, or building your own renderer, a game engine gives you all of that for
free — so you can focus on making the actual game.

ANALOGY

A game engine is a kitchen. It has the oven, the knives, the pans. You are the chef — you decide what dish to cook.
Without the kitchen, you would need to build the oven before you could even start cooking.

2.1 What a Game Engine Provides

Physics Engine Handles gravity, collision, forces, and object motion automatically.

Renderer Draws every frame to the screen — handles lighting, shadows, and materials.

Audio System Plays sounds and music, handles spatial (3D) audio positioning.

Input System Reads keyboard, mouse, controller, and touch input from the player.

Asset Pipeline Imports and manages art, models, textures, and audio files.

Scripting API Lets you write code (C#, Python, etc.) to control game behaviour.

Scene Editor A visual editor to place objects, set up levels, and configure everything.

2.2 Popular Game Engines

Engine Language Best For Known For

Unity C# Mobile, PC, VR/AR, Pokémon GO, Among Us,


Console Hollow Knight

Unreal Engine C++ / Blueprints AAA, PC, Console, VR Fortnite, The Matrix Demo

Godot GDScript / C# Indie, 2D, Lightweight Open source, free forever

TIP

Game Development with Unity — Student Notes Page 4


This course uses Unity. It powers over 50% of all mobile games worldwide and has the best beginner resources,
VR/AR support, and free tier available.

Game Development with Unity — Student Notes Page 5


Chapter 3

The Unity Interface


Navigating the default workspace — the five key panels you use every day.

When you open Unity for the first time, you see five main panels arranged around the screen. Each panel has a
specific purpose. Learning what lives where is the first practical skill.

Scene View Your 3D/2D workspace. This is where you visually place, move, and arrange
every object in your level. Think of it as your stage.

Game View A preview of what the player will actually see through the camera when the
game runs. Press Play here to test your game.

Hierarchy A list of every GameObject currently in the open scene. Objects can be
nested inside other objects (parent-child relationships).

Inspector Shows the properties and components of whatever you have selected in the
Hierarchy or Scene. This is where you configure everything.

Project Panel Your file browser inside Unity. Contains all your assets — scripts, textures,
models, audio, prefabs, and scenes.

Console Displays messages, warnings, and errors from your scripts and Unity itself.
Your best friend when debugging.

3.1 The Inspector in Detail


The Inspector is the most-used panel in Unity. When you click any GameObject, its components appear here as
stacked cards — each showing its settings and values. You can change values, add new components, and
toggle components on or off, all from this one panel.

• Select a GameObject in the Hierarchy → Inspector shows its components


• Click 'Add Component' at the bottom → search and attach any component
• Tick the checkbox beside a component name → disables it without removing it
• Public variables in your C# script automatically appear in the Inspector

KEY POINT

Changing a value in the Inspector during Play Mode is useful for testing, but those changes are lost when you stop
playing. Always make your real changes outside of Play Mode.

3.2 The Package Manager

Game Development with Unity — Student Notes Page 6


The Package Manager (Window → Package Manager) lets you add extra features to Unity without downloading
anything manually. Packages are official or community extensions — the XR Interaction Toolkit for VR,
TextMeshPro for better text, and Cinemachine for cameras are all installed through here.

• Unity Registry — official packages from Unity Technologies


• In Project — packages already installed in your current project

TIP

XR Interaction Toolkit is the package we will install when we reach the VR modules. It provides ready-made
locomotion, grab interactions, and controller input.

Game Development with Unity — Student Notes Page 7


Chapter 4

GameObjects & Components


The two building blocks of everything in a Unity scene.

Every single thing in a Unity scene — the player, the camera, the light, the ground, an invisible trigger zone — is
a GameObject. By itself, a GameObject does nothing. What gives it behaviour, appearance, and physics are its
Components.

ANALOGY

A GameObject is a blank container — like an empty box. Components are what you put inside. A Rigidbody makes
it obey gravity. A Sprite Renderer makes it visible. A script makes it respond to input. The box is just the holder.

4.1 The Transform Component


Every GameObject has exactly one Transform component — it cannot be removed. Transform stores three
properties that define the object's presence in the world.

Position Where the object is in the world. Stored as X (left/right), Y (up/down), Z


(forward/back).

Rotation Which direction the object faces. Stored as Euler angles in degrees on each
axis.

Scale How large the object is. (1, 1, 1) is default size. (2, 2, 2) is twice as big in
every direction.

TIP

In a 2D game, Z position is almost never touched. X = left/right, Y = up/down. That is all you need for 2D
movement.

4.2 Key Components to Know

Rigidbody 2D Adds physics to a 2D GameObject — gravity, mass, drag. Required for


physics-based movement.

Collider 2D Defines the physical shape of an object for collision detection. Does not need
to match the visual exactly.

Sprite Renderer Displays a 2D image (sprite) on the GameObject. Controls the sprite, colour,
and sorting layer.

Game Development with Unity — Student Notes Page 8


Animator Controls animations. Connects to an Animator Controller that defines
animation states and transitions.

AudioSource Plays audio clips. Can be set to 2D (flat sound) or 3D/Spatial (sound affected
by distance).

Camera Defines what the player sees. Every scene needs at least one active camera
to render anything.

4.3 Adding a Component


There are two ways to add a component to a GameObject:

• Select the GameObject → Inspector → click 'Add Component' → search for the component name → click it
• Drag a script file from the Project panel directly onto the GameObject in the Hierarchy or Scene View

COMMON MISTAKE

Adding a script to your Project panel does not attach it to anything. A script only runs when it is attached as a
component to a GameObject in the scene. Always check the Inspector to confirm it is there.

Game Development with Unity — Student Notes Page 9


Chapter 5

The Game Loop & Scripting (C#)


How Unity runs your game every frame, and how you write code to control it.

5.1 The Game Loop


Every game — from Pong to a AAA open-world title — runs on the same fundamental loop. It repeats as fast as
possible, typically 60 times per second (60fps). Each repetition is called a frame.

INPUT Read what the player is doing — keyboard, mouse, controller, touch.

UPDATE Calculate everything — new positions, physics, AI decisions, score changes.

RENDER Draw the current frame to the screen — all objects at their new positions.

In Unity, the Update() method maps directly to the UPDATE step above. Anything you put inside Update() runs
every frame. That is how movement, input checks, and game logic work — they are checked and recalculated
60 times per second.

5.2 A Unity C# Script — Structure


Every C# script in Unity follows this exact structure:

// Basic Unity script template

using UnityEngine;

public class MyScript : MonoBehaviour

void Start()

// Runs ONCE when the game starts

void Update()

// Runs EVERY FRAME (60 times per second)

Game Development with Unity — Student Notes Page 10


Start() Called once when the scene loads. Use it for setup — finding other
components, setting initial values.

Update() Called every frame. Use it for movement, input reading, and anything that
changes over time.

MonoBehaviour The base class all Unity scripts inherit from. It gives you access to Start(),
Update(), and all Unity APIs.

5.3 Variables & Data Types


// Common variable types in Unity

int score = 0; // whole numbers

float speed = 5f; // decimal numbers (note the 'f')

bool isJumping = false; // true or false only

string playerName = "Player 1"; // text

TIP

Make a variable 'public' (e.g. public float speed = 5f;) and it appears in the Inspector. You can then change its value
in the Inspector without editing the script — perfect for tweaking game feel.

Game Development with Unity — Student Notes Page 11


Chapter 6

Physics & Collision


Rigidbody, Colliders, and making objects react to each other.

Unity's physics engine handles gravity, forces, and collision automatically — but only for GameObjects that have
the right components. Rigidbody2D adds physics simulation. Collider2D defines the physical shape.

6.1 Rigidbody 2D — Key Properties

Mass How heavy the object is. Affects how forces move it.

Gravity Scale Multiplier on gravity. Set to 0 to float, 1 for normal, 2 for double gravity.

Is Kinematic When ON — physics engine ignores this object (you control it via script only).
When OFF — physics runs normally.

Use Gravity Toggles whether gravity pulls this object down.

Freeze Rotation Prevents the object from rotating due to physics. Useful for a player character
that should stay upright.

6.2 Collider Types (2D)

Box Collider 2D Rectangular shape. Best for platforms, walls, ground, and most UI-adjacent
elements.

Circle Collider 2D Round shape. Best for balls, coins, or characters with a round base.

Polygon Collider 2D Traces the exact shape of a sprite. Expensive — only use when the shape
really matters.

Is Trigger When ON — the collider becomes a sensor. It detects overlaps but does not
physically block objects.

IS TRIGGER — IMPORTANT

A regular collider physically stops objects. A trigger collider lets objects pass through and instead fires a script
event. Use triggers for: coins you collect, checkpoint zones, damage areas, open doors.

6.3 Collision & Trigger Events


These methods are called automatically by Unity when collisions happen. You add them to your script:

Game Development with Unity — Student Notes Page 12


// Collision and Trigger event methods

void OnCollisionEnter2D(Collision2D col)

// Called when this object physically touches another

void OnCollisionStay2D(Collision2D col)

// Called every frame while touching continues

void OnCollisionExit2D(Collision2D col)

// Called when the objects separate

void OnTriggerEnter2D(Collider2D col)

// Called when entering a Trigger collider

if ([Link]("Coin"))

score += 1;

Destroy([Link]);

TIP

For collision events to fire, at least one of the two GameObjects must have a Rigidbody2D. Two static objects with
only colliders will never trigger collision events.

Game Development with Unity — Student Notes Page 13


Chapter 7

Prefabs
Reusable GameObject templates — the most powerful workflow tool in Unity.

A Prefab is a saved template of a configured GameObject — including all its components, child objects, and
settings. Once created, you can place as many instances of it in your scene as you need. Change the original
Prefab and every instance updates automatically.

ANALOGY

A Prefab is a cookie cutter. You craft the shape once. Every cookie you stamp out looks the same. Change the
cutter and every future cookie changes too — but you can still tweak individual cookies (instance overrides) without
affecting the others.

7.1 Creating a Prefab


• Set up a GameObject in the scene exactly as you want the template to look
• Drag it from the Hierarchy into the Project panel → Unity creates a .prefab file
• The GameObject in your scene turns blue — it is now an instance of the Prefab
• Delete the original from the scene. Drag the .prefab file back in whenever needed

7.2 Prefab Instances & Overrides

Base Prefab The master template stored in the Project panel. Changes here update ALL
instances.

Prefab Instance A copy placed in the scene. Shown in blue in the Hierarchy.

Override A change made to one specific instance (e.g. a different colour). Does not
affect the base or other instances.

Prefab Variant A child Prefab that inherits from a base Prefab but has permanent differences.

Apply / Revert Apply — pushes an override back to the base Prefab. Revert — discards the
override and resets to base.

KEY RULE

Changing the base Prefab updates ALL instances in ALL scenes. Changing an instance only affects that one
object. This is the most commonly misunderstood concept in early Unity work.

Game Development with Unity — Student Notes Page 14


7.3 Instantiating Prefabs via Script
You can spawn Prefab instances at runtime using Instantiate():

// Spawning a prefab at a position

public GameObject coinPrefab; // drag prefab in Inspector

void SpawnCoin()

Vector3 spawnPos = new Vector3(3f, 2f, 0f);

Instantiate(coinPrefab, spawnPos, [Link]);

Game Development with Unity — Student Notes Page 15


Chapter 8

Player Movement Script


Building a complete 2D player controller — movement, jumping, and ground detection.

A player movement script is typically the first complete script students write in Unity. It uses everything covered
so far: Rigidbody2D, Update(), input reading, and C# variables.

8.1 Horizontal Movement


// Basic left/right movement using Rigidbody2D

using UnityEngine;

public class PlayerMovement : MonoBehaviour

public float speed = 5f;

private Rigidbody2D rb;

void Start()

rb = GetComponent();

void Update()

float moveInput = [Link]("Horizontal");

[Link] = new Vector2(moveInput * speed, [Link].y);

GetComponent<>() Finds and returns a component attached to the same GameObject. Run in
Start() so it only runs once.

[Link]() Returns -1 (left), 0 (nothing), or 1 (right) based on arrow keys or WASD.


Smooth — values ramp between -1 and 1.

[Link] Sets the physics velocity directly. We keep the Y value (gravity) and only
override X (horizontal movement).

[Link] The time since the last frame in seconds. Multiply speed by this for
frame-rate-independent movement.

Game Development with Unity — Student Notes Page 16


8.2 Adding a Jump
// Jump with ground detection using collision events

public float jumpForce = 10f;

private bool isGrounded = false;

void Update()

// ... movement code above ...

if ([Link]([Link]) && isGrounded)

[Link]([Link] * jumpForce, [Link]);

isGrounded = false;

void OnCollisionEnter2D(Collision2D col)

if ([Link]("Ground"))

isGrounded = true;

void OnCollisionExit2D(Collision2D col)

if ([Link]("Ground"))

isGrounded = false;

GetKeyDown() Returns true only on the single frame the key is first pressed. Unlike GetKey()
which returns true every frame it is held.

AddForce(Impulse) Applies an instant burst of force — like a kick. Perfect for jumping.
[Link] applies continuously instead.

CompareTag() Checks the Tag of an object. Tags are set in the Inspector. Faster and safer
than comparing .name strings.

isGrounded Our custom flag to track whether the player is on the ground. Prevents
double-jumping.

TIP

Game Development with Unity — Student Notes Page 17


Tag your ground platform as 'Ground' in the Inspector (Tag dropdown at the top). Create a new tag if it does not
exist. The CompareTag() check will only work if the tag matches exactly.

Game Development with Unity — Student Notes Page 18


Chapter 9

Quick Reference
Key terms, shortcut keys, and common errors at a glance.

9.1 Unity Keyboard Shortcuts

Key Action

W Move Tool — translate object in scene

E Rotate Tool — rotate object in scene

R Scale Tool — resize object in scene

Ctrl + Z Undo last action

Ctrl + S Save the current scene

Ctrl + P Enter / exit Play Mode

F Focus on selected object in Scene View

Alt + drag Orbit camera in Scene View

9.2 Common Errors & Fixes

NullReferenceException You are trying to use a variable that has not been assigned. Check: did you
drag the reference into the Inspector? Did you call GetComponent() in Start()?

Missing Collider Collision / trigger events are not firing. Check: does at least one object have a
Rigidbody2D? Are the Collider shapes actually overlapping?

Object not visible Check the Sprite Renderer is enabled, the Sorting Layer and Order are
correct, and the Camera is pointing at the right area.

Purple / Magenta object The material is missing or its shader is broken. Re-assign the material in the
Inspector, or reset to Default Material.

Script not running The script is in the Project panel but not attached to any GameObject. Drag it
onto the object in the Hierarchy.

Changes lost after Play You edited values inside Play Mode. Always exit Play Mode first, then make
your changes.

Game Development with Unity — Student Notes Page 19


9.3 Glossary

GameObject The base object type in Unity. Everything in a scene is a GameObject.

Component A module attached to a GameObject that gives it specific behaviour or


properties.

Transform The component that stores position, rotation, and scale. Present on every
GameObject.

Rigidbody 2D Adds real physics simulation to a 2D GameObject.

Collider 2D Defines the physical boundary of a 2D GameObject for collision detection.

Is Trigger Makes a collider act as a detection zone rather than a physical barrier.

Prefab A reusable, saved template of a configured GameObject.

Scene A single level or screen in your game. A game is made up of one or more
scenes.

Inspector The Unity panel that shows the properties of the selected GameObject.

Hierarchy The panel listing all GameObjects in the current scene.

MonoBehaviour The base C# class all Unity scripts extend. Provides Start(), Update(), etc.

Start() A Unity method called once when the scene first loads.

Update() A Unity method called every frame — the game loop in code.

Tag A label assigned to a GameObject. Used in code to identify object types.

Instance A single copy of a Prefab placed in the scene.

Instantiate() A Unity function that spawns a new copy of a Prefab at runtime.

CompareTag() A method to check a GameObject's tag. Faster than comparing .name.

AddForce() Applies a physics force to a Rigidbody. [Link] = instant burst.

Game Development with Unity — Student Notes Page 20

You might also like