What are Interfaces? (C# Basics)

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ก.ค. 2024
  • 🌍 FREE C# Beginner Complete Course! • Learn C# Beginner FREE...
    🔴 Watch my Complete FREE Game Dev Course! 🌍 • Learn Unity Beginner/I...
    📝 C# Basics to Advanced Playlist • C# Basics to Advanced
    🌍 Get my Complete Courses! ✅ unitycodemonkey.com/courses​
    👍 Learn to make awesome games step-by-step from start to finish.
    🎮 Get my Steam Games unitycodemonkey.com/gamebundle
    ✅ Let's learn all about Interfaces in C# and how they help us write cleaner code!
    Get the Project Files and Utilities at unitycodemonkey.com/video.php...
    Learn Unity in 17 MINUTES!
    • Learn Unity in 17 MINU...
    Learn C# BASICS in 10 MINUTES!
    • Learn C# BASICS in 10 ...
    What are Events? (C# Basics)
    • What are Events? (C# B...
    What are Delegates? (C# Basics, Lambda, Action, Func)
    • What are Delegates? (C...
    What are Interfaces? (C# Basics)
    • What are Interfaces? (...
    What are Generics? (C# Basics)
    • What are Generics? (C#...
    What are Loops? (C# Basics, for, while, do)
    • What are Loops? (C# Ba...
    Unity Tips in 10 MINUTES!
    • 12 MORE Unity Tips in ...
    Unity Basics for Beginners
    • Learn Unity in 17 MINU...
    3 Ways to Shoot Projectiles in Unity
    • 3 Ways to Shoot Projec...
    Modular Character System
    • Modular Character Syst...
    Patreon Sponsor: www.badadventurer.com/
    If you have any questions post them in the comments and I'll do my best to answer them.
    🔔 Subscribe for more Unity Tutorials / @codemonkeyunity
    See you next time!
    📍 Support on Patreon / unitycodemonkey
    🤖 Join the Community Discord / discord
    📦 Grab the Game Bundle at unitycodemonkey.com/gameBundl...
    📝 Get the Code Monkey Utilities at unitycodemonkey.com/utils.php
    #unitytutorial #unity3d #unity2d
    --------------------------------------------------------------------
    Hello and welcome, I am your Code Monkey and here you will learn everything about Game Development in Unity 2D using C#.
    I've been developing games for several years with 7 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.
    You can see my games at www.endlessloopstudios.com
    --------------------------------------------------------------------
    - Website: unitycodemonkey.com/
    - Twitter: / unitycodemonkey
    - Facebook: / unitycodemonkey

ความคิดเห็น • 400

  • @CodeMonkeyUnity
    @CodeMonkeyUnity  4 ปีที่แล้ว +36

    🌍 FREE C# Beginner Complete Course! th-cam.com/video/pReR6Z9rK-o/w-d-xo.html
    🔴 Watch my Complete FREE Game Dev Course! 🌍 th-cam.com/video/AmGSEH7QcDg/w-d-xo.html
    📝 C# Basics to Advanced Playlist th-cam.com/play/PLzDRvYVwl53t2GGC4rV_AmH7vSvSqjVmz.html
    🌐 Have you found the videos Helpful and Valuable?
    ❤️ Get my Courses unitycodemonkey.com/courses or my Steam Games 🎮 unitycodemonkey.com/gamebundle
    Let's learn all about Interfaces in C# and how they help us write cleaner code!

    • @tisurmaster
      @tisurmaster 4 ปีที่แล้ว

      Could you recreate games you made, from scratch? like, the exact same game from scratch.

  • @ArkyonVeil
    @ArkyonVeil 3 ปีที่แล้ว +160

    I've used Unity for around 6 years now and every time I bumped into interfaces, I dismissed them. Seeing them depicted in this way and with a real use case made me better comprehend how useful they can be! Thank you so much for the great tutorials.

  • @toastyshrimp1882
    @toastyshrimp1882 2 ปีที่แล้ว +77

    I have been trying to understand interfaces for SO LONG. Every single video about them seems to skip over passing objects that implement interfaces into methods. Now knowing what they are used for, that was KEY to understanding them. I seriously could not figure out why they were useful because it seemed redundant to define a method in a separate place instead of where you were using it. Thank you, seriously.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 ปีที่แล้ว +9

      I'm glad the video helped you! Thanks!

  • @titanicpat1275
    @titanicpat1275 4 หลายเดือนก่อน +6

    There seems to be 2 kinds of failing to understand something in coding
    The traditional one, we're all familiar with is - _"I didn't understand the words you used, and I couldn't recreate what I saw on screen, because I got it wrong"_
    But the far worse one (and I struggle with this all the time) is _"it's completely clear what you did, I can totally recreate that, but I can't for the life of me work out the value of doing that."_
    Thank you for this video that cured me of the second type!

  • @YuriST
    @YuriST 2 ปีที่แล้ว +1

    Straight to the point, and the damage example showing in practice how to use it makes it very easy to understand. Definetly learned something useful from this and will change my code right away. That's why this video is the top search for "unity interface".

  • @huyopo
    @huyopo 4 ปีที่แล้ว +89

    Another way on how to use Interfaces in unity is to define an Abstract Scriptable Object that implements the functionality of the Interface.
    The clases that implement the interface then have a Serialize field where you can drag in the concrete implementation of the scriptable object.
    And you implement the interface by calling the function on the scriptable object.
    I even got so far to make a propertyAttribute that uses reflection to show all classes that inherit from the abstract class in a dropdown and automatically creates a scriptable object for me.
    You can go really complex with that and you can easily switch between different behaviours just by using a dropdown menu.
    And the best? if you want to add a new function, all you have to do is to create a class that inherits from the abstract scriptable object. Done.

    • @sommmen
      @sommmen 4 ปีที่แล้ว

      thats pretty clever lol

    • @noargames6628
      @noargames6628 4 ปีที่แล้ว

      To be honest that's super useful, I never thought about it

    • @huyopo
      @huyopo 4 ปีที่แล้ว +2

      @@noargames6628 It really is a gamechanger for me.
      And once you use it, you realize you can do a lot more like allowing objects to talk with each other just by sharing the same object

    • @debugdotlog7745
      @debugdotlog7745 4 ปีที่แล้ว +5

      @@huyopo Hey, could you elaborate a little more please, I'm having trouble understanding this implementation

    • @huyopo
      @huyopo 4 ปีที่แล้ว +13

      @@debugdotlog7745 well, the key part is a method that gets all derived classes from a base class you can easily find that using google.
      And with that on hand you can make a custom property drawer that shows a dropdown menu with the contents from that method.
      And if you choose an option it can automatically create the scriptable object for you.
      If you know editor scripting it's actually not that hard, if you don't know it then learn it its really useful.
      If you don't get that, you can skip it and just use it with drag and drop.
      The rest is pretty much an implementation of the strategy pattern. The Monobehaviour implements the Interface and the interface method calls the method on the scriptable object.
      So like this:
      Class Entity:MonoBehaviour,IMovable
      {
      [ScriptableObjectDropdown]
      MoveableScriptableObject moveScriptable;
      void Move()
      {
      moveScriptable.Move(transform);
      }
      }
      abstract class MoveableScriptableObject:Scriptable Object
      {
      public abstract void Move(Transform transform);
      }
      And then you can write a lot of derived classes from the Scriptable object and you can easily switch between them via dropdown.

  • @williamjay2386
    @williamjay2386 3 ปีที่แล้ว +4

    I want to thank you, man. This is one of the best videos I have seen on interfaces, not just because you explain how it works but you gave a concise use case that is common.
    I never thought that I would find a non-esoteric use for interface but I am glad to be proven wrong and to incorporate interfaces in my own project.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว +2

      Thanks! I'm glad you found the video helpful!

  • @nilsmuller-cleve6769
    @nilsmuller-cleve6769 2 ปีที่แล้ว +1

    So far the best explanation I've seen for interfaces and I finally grasped what these things are doing.
    Thanks a lot!

  • @MichaelHeist
    @MichaelHeist 2 ปีที่แล้ว

    Just another video that has dramatically taken away extra lines of code, and simplified my project! I enjoy seeing everything applied and how everything becomes much more scalable.

  • @chuckdude514
    @chuckdude514 2 ปีที่แล้ว +1

    Your didactics never cease to amaze me. Thank you for not only explaining what it is, but also showing us where it can be useful!

  • @charged7177
    @charged7177 3 ปีที่แล้ว +2

    "C# Basics to Advanced" is awesome! Many have (including me) a problem understanding the concepts and how they can implement them to their game.. You cover both! More examples of implementation (problematic vs correct) would be great. Thanx for the help!

  • @zildeos9858
    @zildeos9858 3 ปีที่แล้ว

    i have never been this excited to use something i learned in my life thank you

  • @cwdgamedev1017
    @cwdgamedev1017 3 ปีที่แล้ว +1

    Thank you for making these clear and concise tutorials. You are great at it!

  • @mahmutucak2293
    @mahmutucak2293 4 ปีที่แล้ว +2

    i was expecting this. thank you for your awesome tutorials.

  • @glasgood9907
    @glasgood9907 10 หลายเดือนก่อน

    Excellent, was slightly puzzled by Interfaces and with your clear explanation it now makes sense.

  • @dererzherzog
    @dererzherzog 3 ปีที่แล้ว

    Another one of those great videos by CodeMonkey and the best one out there to understand interfaces. It's very concise and to the point as a whole, but the second part of it (08:30 onward) is like PURE GOLD. Not only is it demonstrating the theoretical purpose and usefulness of interfaces, but also giving a clear, real, no-bullshit implementation example.

  • @subliminalcastillo2126
    @subliminalcastillo2126 3 ปีที่แล้ว +3

    Your video format for tutorials is perfect.
    Brief description of topic in intro.
    An overview of what you'll talk about.
    Teaching about the thing.
    Practical example of thing.
    It's ordered in a clear, concise manner that is captivating, and flows naturally every time.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว +2

      Thanks! I'm glad you like it!

    • @subliminalcastillo2126
      @subliminalcastillo2126 3 ปีที่แล้ว

      ​@CodeMonkey
      I use your videos 10x more than Microsoft's own documentation.
      My brain struggles to remember certain things (product of being a degenerate addict in my youth)
      so I always come back to reference certain things using your videos.

  • @b.c.a683
    @b.c.a683 10 หลายเดือนก่อน

    I started really few days ago and every topic I watched , really nice explanation and simple examples.Thank you for prepared these .

  • @RazixStyle
    @RazixStyle ปีที่แล้ว +4

    I love this video. As a game artist trying to learn C# I need to see how my code works and what it is capable of, the example with the 3 different objects truly creates an Aha moment in my brain!

  • @YuraBazhan
    @YuraBazhan 2 ปีที่แล้ว +1

    Best understand explanasion about Interfaces I ever seen. Thank you a lot!

  • @dennisgonzales9521
    @dennisgonzales9521 4 ปีที่แล้ว +3

    Awesome video, thanks!
    These practical examples are very useful, because it helps ua give the basic idea on how we can implement it by ourselves.
    Now that's what missing at most of tutorials, they just explain it no practical example.
    Thanks again!

  • @iDigvijaysinhG
    @iDigvijaysinhG 4 ปีที่แล้ว +25

    I have knowledge about interfaces since college days but never had easy and realistic example like this.
    Now I would definitely go crazy defining lots of Interfaces, Thanks CM
    No matter how basic your videos are, they are always helpful in one way or another

    • @sleepsleeper4466
      @sleepsleeper4466 4 ปีที่แล้ว +3

      The fucking backhanded compliment at the end was so unnecessary holy shit

    • @beri4138
      @beri4138 3 ปีที่แล้ว +4

      @@sleepsleeper4466 I don't think he meant it that way

  • @leoking3235
    @leoking3235 3 ปีที่แล้ว +24

    I just have just one question ... how on heaven and Earth do you code so fast? Not just typing, but navigating from line to line, cutting and pasting lines, inserting functions etc. It's mesmerising.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว +30

      It's all about experience! I've been writing code for over 20 years!

    • @0xbitbybit
      @0xbitbybit 3 ปีที่แล้ว +4

      Haha you know it's sped up for most of his typing right?

    • @vulcan20
      @vulcan20 3 ปีที่แล้ว +5

      @@0xbitbybit He's not talking about those parts lol

    • @baenbo3486
      @baenbo3486 2 ปีที่แล้ว

      You just gotta learn the shortcuts. They're like magic!

    • @gennadiyshvetsov4115
      @gennadiyshvetsov4115 2 ปีที่แล้ว

      @@CodeMonkeyUnity hello. What’s your take on Interfaces vs Components? It can be HealthComponent instead of IDamagable interface. Component provides implementation but complicates communication(between components of the same gameObject).

  •  2 ปีที่แล้ว

    Finaly I understand the usage of interfaces. Thank you for good lessons!

  • @explior6558
    @explior6558 4 ปีที่แล้ว +27

    Thank you, I had a really hard time understanding interfaces. When I started the video I was completely lost, but with your example everything became really easy! You should keep making examples after the teaching part!

  • @davidvarga2916
    @davidvarga2916 ปีที่แล้ว

    For the first 9 minutes of the video I was clueless of what was happening. Wondering why would I even use this or how. Then you started the example and it clicked. This is exactly what I was looking for. Thanks

  • @guillaumeretureau482
    @guillaumeretureau482 4 ปีที่แล้ว +1

    Hey Code Monkey !
    First of all, thanks for all the effort you have put into this channel, it's great to find people like you ready to help and teach learners! Your channel is kinda my Bible, anything I need, I come here first and most of the time, you answered my question! So thanks you for that and big shout-out for your games, they are great!
    I also had a question: do you have any tip for learning how to make visual art?
    I'm teaching myself about videogame development and if, as a computer science student, code isn't much a problem, art is. I haven't any artistic background and I have trouble making proper characters sprites, scenery, etc...
    I really like the style you use in your games with only a head, a torso and a pair of hands and feet. It seems easier to customize than making a full body everything.

    The visual is what makes me drop every project. I know I could find pre-made packs online but it feels like the game is no longer mine if I use those...
    Thanks for everything and have a good day!
    Guillaume.

  • @thedevquest7676
    @thedevquest7676 4 ปีที่แล้ว

    BOOOM! Love it!!! Literally asked for this today =) thank you

    • @thedevquest7676
      @thedevquest7676 4 ปีที่แล้ว

      11:30 in and It just clicked!.... Wow, this is powerful!

  • @RomainDelmaire
    @RomainDelmaire 4 ปีที่แล้ว +1

    Last tuts I checked about Interfaces showed no example or implementation using an Instance game object so I was left wondering why in hell I would ever use Instances in the first place.
    Great video that explains clearly with a real case scenario!

  • @kennethbailey9802
    @kennethbailey9802 2 ปีที่แล้ว +1

    oh man....your tutorials are taking me to the next level lol, my whole game project is(was) made up without the use of interfaces and generics...thanks for these tuts and the courses on udemy!

  • @stellar7933
    @stellar7933 ปีที่แล้ว +1

    Interfaces look so easy to implement, I'm definitely gonna use them more and write cleaner code with them.

  • @egortyukin6645
    @egortyukin6645 3 ปีที่แล้ว

    Very good explanation. Easy to understand and to follow along. Thank you very much!

  • @l0ckandl0ad
    @l0ckandl0ad 3 ปีที่แล้ว

    Thanks for showing a realistic use case. The problem I had/have with Interfaces (bar newest C# version with an ability to define a default implementation, like you've described) is that you actually do not avoid copy-pasting entirely, because you have to implement the interface in each class anyway. Most of the time I found inheritance/overrides (polymorphic approach) to require less lines of code. But that's not always applicable and not so flexible/extensible as using interfaces, of course, since you need to figure out your tree of inheritance beforehand and then stick to it. Thanks again!

  • @harshbarvaliya8819
    @harshbarvaliya8819 ปีที่แล้ว

    i am a beginner in c# and got so amused by this use case of interfaces , you are setting my expectations high from youtube videos ❤❤❤❤❤❤

  • @MrCaptainbirdman
    @MrCaptainbirdman 4 ปีที่แล้ว

    Very helpful! We use interface for OOP in Java but I never knew how to implement them in Unity C#

  • @Oxmond
    @Oxmond 4 ปีที่แล้ว +3

    Cool stuff! Great C# tutorial! 👍🤓

  • @nocultist7050
    @nocultist7050 4 ปีที่แล้ว +1

    I love you. When I'll have some spare money I'll reward your kindness. I was missing just this bit for so long... If I only found out about it earlier I pobably would be a proper gamedev by now...

  • @RickusDomesticus
    @RickusDomesticus 2 ปีที่แล้ว +1

    This is extremely useful! Thanks for the tutorial!

  • @user-or9jg4ix5i
    @user-or9jg4ix5i 7 หลายเดือนก่อน

    Thank u Mr, usually I can't find anyone else u can explain in an easy way.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  7 หลายเดือนก่อน

      I'm glad the video helped you! Thanks!

  • @davegamedevelopment
    @davegamedevelopment 4 ปีที่แล้ว +17

    Thanks, very helpful for me as learning game dev :D

    • @signalised9540
      @signalised9540 4 ปีที่แล้ว +1

      I find u everyone Dave :D

    • @davegamedevelopment
      @davegamedevelopment 4 ปีที่แล้ว +1

      @@signalised9540 Haha... I'm where the other gamedevs are :D

  • @paulihelsi9852
    @paulihelsi9852 3 ปีที่แล้ว

    Thanks. Your videos are well explained and it's good that you show examples how to use the stuff you teach

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว

      Thanks! I'm glad you found the video helpful!

  • @user-nt1ll1bd2c
    @user-nt1ll1bd2c 4 ปีที่แล้ว

    This tutorial is very helpful. Now I'm the fan of your channel. :)

  • @keetee-ei3er
    @keetee-ei3er ปีที่แล้ว

    Found this channel, I am exited to learn new consepts. Seems like this guy is quite good about explainign things, I am sure it is not easy task to explaing how to write a code for a some codemonkey like myself XD

  • @tigranavagyan1587
    @tigranavagyan1587 ปีที่แล้ว

    Thank's a LOT for this video!!! 👍

  • @vahidseyidov
    @vahidseyidov ปีที่แล้ว

    just cool, into the unity, nice!🙌🏼

  • @Dippps
    @Dippps 4 ปีที่แล้ว

    Hi. Your channel helps a lot to beginner. Best unity channel.

  • @Nova04550
    @Nova04550 2 ปีที่แล้ว

    This made it finally click for me!! Thank you!

  • @johnx140
    @johnx140 2 ปีที่แล้ว

    This was so good!!!! Thank you bro!!

  • @shi-woonyi2605
    @shi-woonyi2605 2 ปีที่แล้ว +1

    Amazing just watched two tutorial from you and it helped me out tremendously, just because you show real use examples.
    I mean interfaces seemed easy but I asked myself "what am I gonna use them for?" After your example it's much easier to find real use for them
    Same for your delegates tutorial!
    Subbed and bookmarked your channel, thank you.
    Time to edit some code.... x)

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 ปีที่แล้ว +1

      I'm glad the videos helped you! Thanks!

  • @edgar1906
    @edgar1906 4 ปีที่แล้ว +2

    Now I see why interfaces are used! Thank you! Could you do a video about how data structures are used in game dev please? (LinkedLists, Queues, Stacks, HashMaps, etc...)

  • @bathtubanarchy
    @bathtubanarchy ปีที่แล้ว

    This was very helpful, thank you.

  • @ayushsidam289
    @ayushsidam289 ปีที่แล้ว

    Wow!!! Thanks sir for the video. 😀👍🏻

  • @ramanujanmadhusudhan8131
    @ramanujanmadhusudhan8131 4 ปีที่แล้ว

    Great video as always, would also like to see a video on the new animation rigging package.

  • @moviesandvisualfx5663
    @moviesandvisualfx5663 2 ปีที่แล้ว

    YOU MAKE THIS SO CLEAR !!!!!!!!!!!!!!! xxxxxxxxxx

  • @algs5483
    @algs5483 ปีที่แล้ว

    Quite interesting! Thanks Hugo!

  • @liiiar
    @liiiar 3 ปีที่แล้ว +2

    Uau. Agora entendi a importância de interfaces! Fez meu dia terminar com chave de ouro, muito obrigada!

  • @vincewa2142
    @vincewa2142 ปีที่แล้ว +2

    I spent the last 2 hours searching the web for how to see if an object contains a interface of a particular type similar to what you showed except through ray casting. After watching your video I confirmed I was executing my code correctly and it should have been working the way I thought it would have (for example being able to do TryGetComponent) When it didn't work I thought maybe you cant do that since its not the classes direct name but you confirmed my thought that you can. Then I noticed it was because I had a box collider on the object and not a box collider 2D. (Im making a 2D game) And that's how I wasted 2 hrs of my life.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  ปีที่แล้ว

      Heh that happens, good news is the next time you come across a similar issue you already know what might be the problem!

  • @tostpl8258
    @tostpl8258 4 ปีที่แล้ว +2

    Yeah I already knew what are interfaces and how they work but still like this video
    Btw I can't wait until unity support c# 8 :) It will be awesome.

  • @vandermunnik
    @vandermunnik 2 ปีที่แล้ว

    I never really had to use interfaces, didn't see the point of using them - until now! I had another system in place for my game (unity events) where the player can look at objects (FPS game) and interact with it using a mouse click if the gameobject had an 'interactable' component attached to it, I ditched it because now I totally understand interfaces now Code Monkey thanks to you - no one else was able to properly explain its purpose - I implemented it and my code is so much cleaner now!! (cut out like 50 lines of code), thanks again!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 ปีที่แล้ว

      That's awesome, I'm glad the video helped! Thanks!

  • @sandip_1698
    @sandip_1698 ปีที่แล้ว

    i have fear to learn interfaces but when i watch your video then its gone, and i also started to loving interfaces as well as your flow of teaching that, thank you so much sir

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  ปีที่แล้ว +1

      I'm glad you're no longer afraid, they are an excellent very powerful feature!

  • @mehdidev9926
    @mehdidev9926 ปีที่แล้ว

    best video ever on interfaces ,thank youuuuuuuuuuuuuu

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  ปีที่แล้ว +1

      I'm glad the video helped you! Thanks!

  • @AndreaLPM1
    @AndreaLPM1 3 ปีที่แล้ว

    Amazing tutorial!

  • @B4NTO
    @B4NTO 2 ปีที่แล้ว +1

    Thx for your videos they are great :)

  • @improvefps
    @improvefps 4 ปีที่แล้ว +1

    if your struggling to follow along as he is explaining like i did because he talks really fast while explaining like this class uses this interface which uses this function and start to get confused then changing the playback speed to 0.75 speed and sometimes pausing to think helped me to eventually grasp interfaces :)

  • @MikeStock88
    @MikeStock88 ปีที่แล้ว

    Awesome, thanks for sharing

  • @brianwilson7497
    @brianwilson7497 ปีที่แล้ว

    beautiful, thanks

  • @rutchjohnson
    @rutchjohnson 4 ปีที่แล้ว +3

    Wow, so powerful!

  • @TheJangoo
    @TheJangoo 5 หลายเดือนก่อน

    Excellent explanation 😁

  • @thiengen3426
    @thiengen3426 4 ปีที่แล้ว

    Thanks , it's helpful

  • @moduntilitbreaks
    @moduntilitbreaks 4 ปีที่แล้ว

    Quality top as always(Y)

  • @florinpricopie9112
    @florinpricopie9112 4 ปีที่แล้ว

    Thanks !

  • @unityvictor787
    @unityvictor787 3 ปีที่แล้ว

    Very Good Tutorial!! EZ 2 understand

  • @Daeniak57
    @Daeniak57 3 ปีที่แล้ว

    Hi im french Canadian and i just want to say you helped me a lot, thank you!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว +1

      I'm glad to hear it! Thanks!

    • @Daeniak57
      @Daeniak57 3 ปีที่แล้ว

      @@CodeMonkeyUnity No problem

  • @spectralspace8866
    @spectralspace8866 ปีที่แล้ว

    Thank you!!!!!!!!!!!!

  • @svetavasilieva7841
    @svetavasilieva7841 4 ปีที่แล้ว

    Thank you very much

  • @brewstewfilms8752
    @brewstewfilms8752 4 ปีที่แล้ว +1

    Thank you Code Monkey!

  • @ashutoshaswal
    @ashutoshaswal 3 ปีที่แล้ว

    Awesome Content

  • @pamalott5
    @pamalott5 4 ปีที่แล้ว

    I love your vids.

  • @junaidywijaya
    @junaidywijaya ปีที่แล้ว

    Just to say thanks and tell you, this way of teaching is really good for many reasons, not only explain the definition but also showing a real case scenario and after watching and searching other videos, this one is still the best one and easiest to understand, i do have watched your explanation about events and also delegates, but i forgot it sometimes and keeps coming back, so just want to say thanks for all the works you do, and i hope you found your success in your current project, and also i want to ask about planning for the future, any new paid course in udemy, i really wondering how to create the chart in your blueprint steam game, and how to manage those data, I've tried to make something similar but ended up a mess, i knew you are busy these days, and yeah I'm just mainly want to say thanks. 😅

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  ปีที่แล้ว +1

      It's perfectly okay to keep coming back as long as every time you come back it's easier to remember how it works.
      For example there are some things, like how to read a file, that I just google everytime because I never memorize it, but a quick google instantly makes me remember

  • @zekiozdemir420
    @zekiozdemir420 2 ปีที่แล้ว

    Thank you

  • @kken8766
    @kken8766 4 ปีที่แล้ว

    good job!!

  • @jud.su.5developer895
    @jud.su.5developer895 ปีที่แล้ว

    Wow 🤩 ❤

  • @zekiozdemir420
    @zekiozdemir420 3 ปีที่แล้ว

    thank youuu

  • @devdog7409
    @devdog7409 ปีที่แล้ว

    To help understand the concept of interfaces:
    Interfaces are like middlemen for class dependencies. You don't have to worry about breaking dependencies when you change or switch out a class it depends on as long as it implements the same interface. The dependency just needs to know how to use the interface to get what it needs. It doesn't care how that output is produced as long as it works. When a class has implemented an interface, you know what methods to expect from it and if you ever delete one of the methods it will throw an error to ensure the agreed upon methods are being used (errors are caught immediately at the source instead of at runtime wondering what happened).
    Analogy:
    A DVD player and a blue ray player work differently yet expose the same interface (play, stop, fast forward, etc.). This way, the user doesn't have to know what is going on inside the machine. As long as they understand the interface, they can get the desired output (the video). This way they can switch out a DVD with a blue ray player and still get what they want.

    • @jayocaine2946
      @jayocaine2946 ปีที่แล้ว

      Pretty bad explanation sorry. You used a lot of jargon. And the analogy doesn't really work. The best way to understand interfaces is to go make a finite state machine using them.

  • @Gino12164
    @Gino12164 4 ปีที่แล้ว +1

    I like interface working togetter with a abstraction. you can make really powerfull things out of it.

  • @MaskedImposter
    @MaskedImposter ปีที่แล้ว

    Interfaces are interesting and I've been wanting to try and use them for awhile, but I haven't found a good use case yet in my projects. Usually I have this stuff covered by inheritance or a component style approach. In your example instead of an interface, I prefer having a health component that only deals with health. And it fires off C# events for things like taking damage and death. Other components can listen for those events for customization purposes.

  • @mattshu
    @mattshu 2 ปีที่แล้ว

    This makes so much sense in Unity but I still have trouble grasping practical uses of interfaces in other coding situations outside of game making

  • @AxZelAnimations30
    @AxZelAnimations30 2 ปีที่แล้ว

    I really need something like this because I'm planning on making a bunch of characters with different scripts but the damages and knockbacks needed to work the same for everyone.
    The first examples are so confusing I wanted to give up and just do the "everyone will share the exact one script" mindset, until I reach the part of the video with actual implementation and it's much easier to understand.

  • @jason_s3597
    @jason_s3597 ปีที่แล้ว

    U BEST!!!

  • @empressredbird
    @empressredbird ปีที่แล้ว

    very cool feature

  • @rafaelcorrea7959
    @rafaelcorrea7959 4 ปีที่แล้ว +1

    It would be cool tutorials with design patterns, code principles. KISS, SOLID, DRY, rarely see those in game tutorials.

    • @rafaelcorrea7959
      @rafaelcorrea7959 4 ปีที่แล้ว

      @Violet twd, keep it simple sucker (that's the actual name)

  • @kanewadel
    @kanewadel 2 ปีที่แล้ว

    thanks

  • @techbytefrontier
    @techbytefrontier 4 ปีที่แล้ว

    i love how c# looks familiar with Java, helps a lot for me.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว +1

      They are indeed very similar, if you know Java you will quickly learn C#

  • @thepolandman2447
    @thepolandman2447 3 ปีที่แล้ว

    Very nice explanation! +1 Sub

  • @arabianlegend5897
    @arabianlegend5897 2 ปีที่แล้ว +4

    Hello Code Monkey! Thanks for the great tutorials man! I just had a curious question. At 11:45 you got the component even though you did not attach the IDamageable script to the gameobjects. Since Unity did not detect a "IDamageable" script component, does it try and get any other script in that gameobject that has inherited that "IDamageable" script? (in this case the "Enemy" or "Crate" script components) How does it work exactly? Also I am loving your Builder Defender course so far, keep producing great content!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 ปีที่แล้ว +7

      You cannot attach an interface directly since an interface isn't something you can instantiate by itself, instead you attach some script that implements the interface.
      Then using GetComponent it checks if any of the attached components implement that interface.
      I'm glad you're enjoying the course! Thanks!

    • @vojtechjezek7317
      @vojtechjezek7317 11 หลายเดือนก่อน

      Thanks for asking this, I was gonna ask the same question haha

  • @bubishev6376
    @bubishev6376 ปีที่แล้ว

    WOW! S y very much

  • @GreenCube-rt7cr
    @GreenCube-rt7cr 9 หลายเดือนก่อน

    Thanks

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  9 หลายเดือนก่อน

      Thanks for the super thanks!

  • @erixperimentation4666
    @erixperimentation4666 ปีที่แล้ว +1

    With interfaces it isn't even "inherit" anyway, you *implement* interfaces, not inherit from them. C# is still only a single inheritance language, but it allows you to get around this limitation with it by implementing multiple interfaces.

  • @DavidZobristGames
    @DavidZobristGames 4 ปีที่แล้ว

    thannnnnksss

  • @autismlim454
    @autismlim454 4 ปีที่แล้ว +2

    Awesome! Anyway can you explain on how to use struct and when to use it?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว +1

      Sure, I covered Classes vs Structs here th-cam.com/video/KGFAnwkO0Pk/w-d-xo.html