Uploaded September 2022 | Updated September 2026, 1 hour ago
With this tutorial, aimed at absolute beginners who have very little to no coding experience whatsoever, you'll learn what Composition is and how to use it (you already are using it!). You'll learn when to use a compositional relationship versus an inheritance relationship and what the benefits are for favoring Composition over Inheritance.
If you've been using Unity for a while, or are just getting started with Unity and decided it's time for you to start learning how to write code - this is the video series you need to start your programming journey!
This video we didn't implement anything new, so there's no new repository!
📝📝📝YOUR HOMEWORK!📝📝📝
Do some data modeling for enemies that can attack the player. Starting with 3 types:
1. Melee enemy
2. Ranged enemy
3. Boss enemy
4. Ranged and Melee attacking enemy.
Revisit your last homework to create inheritance and compositional relationships and interfaces to allow you to group common code and variables, define "can-do" relationships that allow you to extend what enemies and bosses can do in the future without significant rework.
🔶 ALL THINGS LlamAcademy now available at: https://llamacademy.dev/support including latest tutorials, courses, ways to support, and more! Check it out 🙂
👨💻 Get the FULL FREE PROJECT on GitHub: github.com/llamacademy/unity-csharp-basics-6
🏷️Save 25% on the ultimate C# IDE: JetBrains Rider with code LLAMACADEMY: jetbrains.com/store/?section=personal&billing=yearly
📚 Resources 📚
🟠 Further reading on the topic: scottlilly.com/c-design-patterns-composition-over-inheritance
🟠 C# Fundamentals - Inheritance: docs.microsoft.com/en-us/dotnet/csharp/fundamentals/tutorials/inheritance
🟠 C# Access Modifiers: docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/access-modifiers
🟠 C# Interface: docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/interface
🟠 C# Virtual: docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/virtual
🟠 C# Overriding methods: docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/knowing-when-to-use-override-and-new-keywords
Full Series Playlist Here: youtube.com/watch?v=SXaa61JWLDw&list=PLllNmP7eq6TTjwoyfRYAAFOH1sMHVgI1r
🟠 Part 1 - Writing your first script
🟠 Part 2 - Loops and Arrays
🟠 Part 3 - Unity Component Lifecycle
🟠 Part 4 - Static vs Instances
🟠 Part 5 - Delegates
🟠 Part 6 - Inheritance & Interfaces
🟠 Part 7 - You are here 😉
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.
Chapters:
00:00 What is Composition?
00:45 Quick Refresher on Inheritance vs Composition
01:36 First Benefit of Composition
02:55 Real Life Example Demonstrating Why We Need Composition
04:22 Humble Bundle! Unity Tools
05:40 Second Benefit of using Composition
06:54 2 Problems Solved by Composition
08:12 Design Thinking!
09:47 Become a Patreon Supporter
10:18 Homework Assignment
11:55 Final Thoughts
With this tutorial, aimed at absolute beginners who have very little to no coding experience whatsoever, you'll learn what Composition is and how to use it (you already are using it!). You'll learn when to use a compositional relationship versus an inheritance relationship and what the benefits are for favoring Composition over Inheritance.
If you've been using Unity for a while, or are just getting started with Unity and decided it's time for you to start learning how to write code - this is the video series you need to start your programming journey!
This video we didn't implement anything new, so there's no new repository!
📝📝📝YOUR HOMEWORK!📝📝📝
Do some data modeling for enemies that can attack the player. Starting with 3 types:
1. Melee enemy
2. Ranged enemy
3. Boss enemy
4. Ranged and Melee attacking enemy.
Revisit your last homework to create inheritance and compositional relationships and interfaces to allow you to group common code and variables, define "can-do" relationships that allow you to extend what enemies and bosses can do in the future without significant rework.
🔶 ALL THINGS LlamAcademy now available at: https://llamacademy.dev/support including latest tutorials, courses, ways to support, and more! Check it out 🙂
👨💻 Get the FULL FREE PROJECT on GitHub: github.com/llamacademy/unity-csharp-basics-6
🏷️Save 25% on the ultimate C# IDE: JetBrains Rider with code LLAMACADEMY: jetbrains.com/store/?section=personal&billing=yearly
📚 Resources 📚
🟠 Further reading on the topic: scottlilly.com/c-design-patterns-composition-over-inheritance
🟠 C# Fundamentals - Inheritance: docs.microsoft.com/en-us/dotnet/csharp/fundamentals/tutorials/inheritance
🟠 C# Access Modifiers: docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/access-modifiers
🟠 C# Interface: docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/interface
🟠 C# Virtual: docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/virtual
🟠 C# Overriding methods: docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/knowing-when-to-use-override-and-new-keywords
Full Series Playlist Here: youtube.com/watch?v=SXaa61JWLDw&list=PLllNmP7eq6TTjwoyfRYAAFOH1sMHVgI1r
🟠 Part 1 - Writing your first script
🟠 Part 2 - Loops and Arrays
🟠 Part 3 - Unity Component Lifecycle
🟠 Part 4 - Static vs Instances
🟠 Part 5 - Delegates
🟠 Part 6 - Inheritance & Interfaces
🟠 Part 7 - You are here 😉
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.
Chapters:
00:00 What is Composition?
00:45 Quick Refresher on Inheritance vs Composition
01:36 First Benefit of Composition
02:55 Real Life Example Demonstrating Why We Need Composition
04:22 Humble Bundle! Unity Tools
05:40 Second Benefit of using Composition
06:54 2 Problems Solved by Composition
08:12 Design Thinking!
09:47 Become a Patreon Supporter
10:18 Homework Assignment
11:55 Final Thoughts










