GameDev Unity Notes
GameDev Unity Notes
7. Prefabs 17
9. Quick Reference 22
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.
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.
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.
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.
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.
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.
Unreal Engine C++ / Blueprints AAA, PC, Console, VR Fortnite, The Matrix Demo
TIP
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.
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.
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.
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.
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.
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.
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.
• 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.
INPUT Read what the player is doing — keyboard, mouse, controller, touch.
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.
using UnityEngine;
void Start()
void Update()
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.
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.
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.
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.
Freeze Rotation Prevents the object from rotating due to physics. Useful for a player character
that should stay upright.
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.
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.
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.
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.
void SpawnCoin()
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.
using UnityEngine;
void Start()
rb = GetComponent();
void Update()
GetComponent<>() Finds and returns a component attached to the same GameObject. Run in
Start() so it only runs once.
[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.
void Update()
isGrounded = false;
if ([Link]("Ground"))
isGrounded = true;
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
Quick Reference
Key terms, shortcut keys, and common errors at a glance.
Key Action
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.
Transform The component that stores position, rotation, and scale. Present on every
GameObject.
Is Trigger Makes a collider act as a detection zone rather than a physical barrier.
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.
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.