Interfaces & Inheritance

Inheritance lets a class build on another class, and an interface promises that a class has certain members without saying how they work. Unity uses both constantly: every script inherits from MonoBehaviour, and an interface like IDamageable is how one sword can hit a barrel, an enemy, and a door with the same line of code.

More in C# Foundations

  1. Variables & Types
  2. Control Flow & Loops
  3. Methods & Classes
  4. Collections
  5. Interfaces & Inheritance
  6. Delegates & Events

All 42 topics in the Learn Unity Roadmap