Unity C# Fundamentals - Interfaces and why C# interfaces are so powerful?

preview_player
Показать описание
Unity C# interfaces can be powerful specially when we need to easily swap implementation by another implementation. In this video I provide you with examples where we create an IInputControl interface, ControlTouch & ControlKeyboard classes that both inherit from the IInputControl interface.

We also go through adding methods to an interface and a property which drives the type of control we're creating.

The project demonstrated in this video can be downloaded or cloned from:

Get realtime indie development tips from me in Twitter

Subscribe to my indie development videos & game releases newsletter

Blog about Indie development and startup
Рекомендации по теме
Комментарии
Автор

Thanks for the video, Dilmer. That helped me understand Interfaces a lot better.

cam
Автор

A VERY good explanation of interfaces, thanks.

MrZtapp
Автор

(5:55) One can be even lazier and let the IDE (VS for me) fill it for you on two clicks, explicitly or implicitly.

ElighneArkaine
Автор

Thanks for the video! Tip: to implement interface in VS Code (and do many other things) highlight / select the interface (underlined error part) after ":" and a light bulb will appear in the beginning of the line. Click it and select implement (to automatically implement interface). Just wondering, why they chose to put many important operations behind such a hidden UI.

ss
Автор

Thanks for the video.
can you make the font bigger a little bit in vscode (using ctrl + mouseWheel) next time it would be appriciated :D, i dont have a good internet to watch in HD

oualidelouassif
Автор

there is no explain what is Interfaces and why C# interfaces are so powerful

hammry
Автор

Yo, found this video because I'm trying hard to understand why would Interfaces be useful. I get that they are kind of blueprints that "forces" me to create based on the blueprint itself.. that is cool. My question is: "why should I use interfaces instead of, let's say, an abstract class that lets me just as easely override all commands plus adding them to the method with a simple quick fix? Wouldn't it obtain the very same result but saving time? PErhaps there's a difference in memory allocation and performance?

So.. I don't really get what the great advantage of using interfaces is :(

ilnabbo
Автор

The irony is real xD.
I just discovered, that modern C# has default implementations for interfaces, which is exactly what I'd need; but Unity doesn't support C#8 yet, so...
"Interfaces and why C# interfaces are so powerful?" is at large irony here... Unity doesn't contain all of C#'s interface power.

AntonioNoack
join shbcf.ru