Abstract Classes Explained in under 3 minutes (with practical #unity3d examples)

preview_player
Показать описание

00:00 - Intro & Abstract Class Definition
00:30 - Why do we want to use them? Items Example
01:27 - Interacting with Interactive Objects
02:08 - Overriding virtual methods in abstract classes (CanInteract)
02:15 - Pitfalls to avoid
02:50 - Serialization and adding to GameObjects
03:15 - Outro
Рекомендации по теме
Комментарии
Автор

The beauty of Abstract Classes (in my opinion) is the possibility of implementing different behaviours in it's Children Classes (or Derived), very similar to the case of a Contract (using Interfaces)... but with the difference that we are allowed to have Class Fields (i.e.: member variables). That's a cool thing about Abstract Classes, because with Interfaces we can just list Methods, not Fields.

alec_almartson
Автор

As someone who works at a non-game dev job with little free time to game dev I appreciate short to the point videos like this as it leaves more time to actually try it out. I like this short format for topics like this, but I would prefer the usual longer videos for how to do bigger picture things that require two or more topics.

jamesknecht
Автор

The video was good, short and to the point. But I think that in todays society, rambling has it's place. It could be something that you encountered, use case that was good or not good it slows down the pace a bit, but can still provide useful information. It also gives videos more "meat on the bones" a sense of being present sometimes. Not simply cold hard facts.

Bones are great, without them you would just be a pile that hardly could do anything, but without the meat you wouldn't be able to do anything at all. So my preference is "more meat" (that is more "ramblings"), coming from an experienced person it is most often worth the time. You might perhaps not recognize it at the time, but it is good to have heard for the future, most of the time. :)

andersmartensson
Автор

I am implementing the usage of Items right now, what a great timing! thank you so much! <3

Gaguera
Автор

Quite succinct, I think it will serve as a good introduction to those who are not overly familiar with abstract classes. There's the added benefit of highlighting an example of when interfaces would be more appropriate, and I find this helps bridge the gap for a fair amount of people who are self taught and still struggling to see the usefulness of interfaces.

Perfect length to get people talking and and asking questions, and that discourse could give an indication if a longer video on the topic is needed to focus on certain areas.

arkonza
Автор

Great video, guess I have to watch it at least 3 times (while taking notes) to grasp all the valuable content. Thank you

saschacontes
Автор

It's really well explained, I always loved your content for that, everything is always explained with examples !

Thank you for taking your time to help us !

Daeniak
Автор

Abstract classes, and inheritance at large, is such a godsend for avoiding repeat code. Drawing up an inheritance tree that shows GameObject -> Item -> Equipment -> Weapon -> Sword -> Blade of Darkness and explains the logic of putting it together - that sense of putting certain methods at certain layers where you know they'll get used by everything that inherits, and then adding methods with increased specificity as you continue to inherit.

TheKarishi
Автор

I used them a lot in my RPG project for items, and a character abstract class for NPCs and players that has the common stuff like health, movement speed, etc. And common functions

rambii.
Автор

Thank you for including the pitfalls and when NOT to use this. That information is equally as important!

sveden
Автор

Honestly, I like your slightly longer format videos more. When you "ramble" you give some really good ideas to beginning and intermediate coders that haven't been introduced to some of the issues or idea that come with time and experience. This video seemed to be missing some of the meat of the topic of your other informational videos. I've been watching for years and I've gained a lot of really good coding knowledge and wisdom from you. Bottom line, this video is a bit too short for the topic.

universalequalitypro
Автор

Knowing when to use abstract and when you use interface is always a little tricky. I think that's inheritance vs composition, correct?

TChrisBaker
Автор

Well, how did you get into my account?
But your channel is nice, I will subscribe

ahmedfireplus
Автор

Great overview/summary. Since you just covered this in the bootcamp, I already understood the subject, so I'm probably not the best person to say whether it was too short. As mentioned earlier, I do find the production a little distracting (even though I thought it was well done)

ltweed
Автор

Good video! Abstract classes and interfaces are great!

KHodow
Автор

Wondering if his course is also suitable to learn 2d turn based strategy games? Somebody know?

lineofdeparture
Автор

I have a "unit" class that I used as a store for every parameter a unit has (health, armour, etc) and later I implemented moving units that also has have other stats (speed, etc) and ofc these stats, albeit unused, are present also for my non movable units. do you recommend using an abstract class? An interface? Note: this class is used by some other scripts (health, movement, a specialized turret script) to gather the unit stats

matteosberna
Автор

The thing that sucks is that interfaces cannot be serialized in inspector. Also can put child class objects in a list by its parent class type, but C# pretends it knows nothing about methods or properties on the said objects that come from child class(unless you cast to it)

dbweb.creative
Автор

I have some troops in my project and i'm deploying them as a user. so I've three different key features for the troops 1. Troop Type(Ground, Air) which would be an abstract class and will define the core logic for the movement for both types 2. Troop target (multiple) it would be an interface and a "Has a" relation so i can make it for multiple targets and can implement multiple targets for the same troop 3. Attack type(close ranged, long ranged) which would also be an abstract class so my troop attack class will inherit from this abstract class and will have multiple targets and troop movement claas will inherit from the movement So now is my approach is good or too complex for no reason or any other flaws? can you suggest something

gamerscreed
Автор

Hey Jason great video. Can you make a video about related with Scene Management. I mean when should we create new scenes. Yes it depends to game but there isn't any clear video about that.

KaanErayAKAY