Learn Unity and C# by Making Games / C# Fundamentals
Understand how classes describe things and objects become the things your game uses.
Example:
1public class Enemy2{3 public int health = 100;4 5 public void TakeDamage(int amount)6 {7 health -= amount;8 }9}But on its own, it doesn’t exist in the game yet.
An object is a real, living version of that blueprint.
In Unity, when you attach a script to a GameObject, Unity creates an instance (object) of that class.
You can also create multiple objects from the same class:
1Enemy goblin = new Enemy();2Enemy troll = new Enemy();3 4goblin.TakeDamage(20);5troll.TakeDamage(50);Now we have two enemies - each with their own health.
In Unity, your scripts usually extend (inherit from) MonoBehaviour:
1public class Player : MonoBehaviour2{3 public int health = 100;4 5 void Start()6 {7 Debug.Log("Player spawned!");8 }9}MonoBehaviour gives you access to Unity-specific magic like:
Start(), Update(), OnCollisionEnter()GetComponent<>()Basically, it plugs your code into the Unity engine.
Let’s say you want each enemy to have its own health and logic:
1public class Enemy : MonoBehaviour2{3 public string enemyName;4 public int health;5 6 public void TakeDamage(int amount)7 {8 health -= amount;9 Debug.Log(enemyName + " took " + amount + " damage!");10 }11}Now you can:
TakeDamage() from another script when needed🎉 Boom - reusable, scalable logic!
Even the Unity components like Rigidbody2D, Camera, and Transform… are all classes!
Enemy.cs with:
public string enemyNamepublic int healthpublic void TakeHit(int damage) that logs a messageTakeHit() from another script to damage each oneOptional: Make enemies explode into a dramatic Debug.Log.
Now that you know how to write reusable scripts and build structured logic, it’s time to learn how Unity handles code in motion - with its unique built-in methods like Start() and Update().
⚙️ Go to Lesson 12 → Unity-Specific Scripting (MonoBehaviour, Start, Update)
Keep it small enough to finish in five minutes, then write down what changed and what Unity showed you.
What is the best next step after reading a lesson section?
download
Use this before starting a new Unity prototype.
reference
Official reference for Unity editor concepts, components, and workflows.
reference
The fastest way to verify classes, methods, and Unity-specific behavior.
download
Checklists and creator resources for keeping projects moving.