Inheritance and Interfaces for Beginners | Unity C# Basics 6 | Unity Tutorial

preview_player
Показать описание
With this tutorial, aimed at absolute beginners who have very little to no coding experience whatsoever, you'll learn what Inheritance is (it's not passing on hereditary traits or getting money!), how to use it (you already are using it!), what an Interface is, how to use it, and what the difference between the two are!

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!

📝📝📝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

Create inheritance 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.

📚 Resources

🧡 Believe in LlamAcademy's mission and have received value from the videos? Here's how you can show your support:
📚 Take my Unity ShaderGraph Course:

Chapters:
00:00 Topic Introduction - You've already been using Inheritance!
01:15 Inheritance Relationship Defined
02:40 Inheritance by Real Life Example
05:20 Interfaces - Definition, Examples, and Benefits
09:28 Relating it all back to Unity
10:48 What's Inheritable from the Parent? (Access Modifiers)
13:33 Hands-on Exercise using Inheritance
18:44 Scene Updates & Demo
21:00 Homework! Review & Next Assignment

Рекомендации по теме
Комментарии
Автор

Man, code classes live in a perfect world. Inheritance passed down from one generation to the next with no loss and you don't have to share with other inheritors. Plus your parents don't have to be dead. Truly a paradise.

poobagification
Автор

This series is incredible! Thank you for making this.

terryterry
Автор

Abstract interfacing techniques (like base classes, abstract classes, and interfaces) is an amazing technique that can be used to write algorithms that polymorphically use the abstraction. IMO I prefer interfaces especially in unity because it lets me define what roles my game entities can adopt and because interfaces lets me treat MonoBehaviours, ScriptableObjects, and vanilla C# classes as basically the same. Not to mention interfaces work great with NSubstitute which is great for test mocks. Designing your unity code with interfaces in mind is a bit of a mind f@*k but I think the effort is worth it. IMO.

andrewallbright
Автор

hi sir! please if you can help me! i start to make game like a puzzle game ( INSIDE ) but mine is 2D not 3D like INSIDE. my game is adventure puzzle game exactly like INSIDE.
but theres my some problems if you can help me in tutorial video bcs my english its so bad. and you can help many people. ( i wish to help bcs i was asked many youtubers and no one care about my problems ) .. theres my problems :
i dont know how exactly i make a smouth dynamic physicaly moves of player ( jump .., climb and hang ledges.., Climb and Swing on Ropes..) i saw a thousand of tutorials but all those just learn you how to make a simple code or not exactly what i want, bcz i need i movement like INSIDE .. and you know game is for puzzles so i need dynamic and physics in player movement.. this is one of my big problems. ( if you have a bonus of some physics puzzle to help me more )
game is fully 2D.
please help me in tutorial video to make me understand and help me. i really 2 years and a thousand videos and no saw what i need. please help sir please!

RedaHaskouri