Learn Unity and C# by Making Games / C# Fundamentals
Learn MonoBehaviour, Start, Update, and the Unity lifecycle basics.
In Unity, there are special built-in methods - like Start(), Update(), and OnCollisionEnter() - that Unity calls automatically at specific times.
This is made possible through MonoBehaviour, Unity’s magical base class that connects your scripts to the engine.
All your Unity scripts inherit from this class:
1public class MyScript : MonoBehaviour2{3 // Magic lives here4}By inheriting from MonoBehaviour, Unity can call special methods like Start() and Update() without you needing to do anything else.
1void Start()2{3 Debug.Log("The game has started!");4}Update()1void Update()2{3 Debug.Log("Still running...");4}1using UnityEngine;2 3public class HelloUnity : MonoBehaviour4{5 void Start()6 {7 Debug.Log("Game started");8 }9 10 void Update()11 {12 Debug.Log("Frame running...");13 }14}| Method | When it Runs |
|---|---|
Awake() | Before Start() (used for internal setup) |
FixedUpdate() | Called at fixed intervals (physics-related) |
OnCollisionEnter() | When object collides with another |
OnTriggerEnter() | When trigger collider is entered |
OnDestroy() | When the object is removed from the scene |
We’ll explore these more in future lessons. For now, Start() and Update() are your go-to tools.
MonoBehaviour connects your code to Unity’s event systemStart() runs once when the object activatesUpdate() runs every frame (use it for live logic)FrameTracker.csUpdate(), increase a counter every frame"One second-ish passed"Bonus: Try printing a message every 5 seconds using a float timer instead!
Next up, we’ll build our very first game together - a classic clicker game to put your skills into action!
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.