Learn INTERFACES in 5 minutes | Unity

Поделиться
HTML-код
  • Опубликовано: 27 июн 2023
  • Learn how to use interfaces in this quick Unity tutorial.
    In this example, we will use the IInteractable interface to interact with any object that implements that interface.
    ✅ Get my courses with discount:
    👉 Unity 2D Master: www.udemy.com/course/unity2dm...
    👉 Unity Mobile Course: www.udemy.com/course/unitymob...
    👉 Unity Input System with Rebinding: www.udemy.com/course/unity-in...
    👍 Save your time and learn Unity faster
    -------------------------------------------------------
    🔔 Subscribe for more awesome content:
    🔴 / @rootgames
    -------------------------------------------------------
    🟡 Support this channel through donations
    Any amount means a lot and will help grow the channel:
    👉 PayPal: www.paypal.com/paypalme/rootg...
    -------------------------------------------------------
    Social Networks:
    ⭐ Instagram: / rootgamesofficial
    ⭐ Twitter: / rootgamescro
    ⭐ TikTok: www.tiktok.com/@rootgamesoffi...
    ⭐ Facebook: / root-games-10337038860...
    -------------------------------------------------------
    #unity #interface #interfaces #unitytutorial

Комментарии • 23

  • @PoisonedAl
    @PoisonedAl 11 месяцев назад +7

    Once you learn Interfaces and Events, life gets a lot simpler and your code WAY cleaner. Get scriptable objects in there too and you can remove a lot of your dependencies.

    • @RootGames
      @RootGames  11 месяцев назад

      True facts 👍🏻

    • @markorossie9296
      @markorossie9296 11 месяцев назад

      Please that sounds very useful. Please consider make a tut of how. Thanks

    • @Fyres11
      @Fyres11 7 месяцев назад

      Totally agree. I use SO as middle man for my events and it work great!

  • @Soundy777
    @Soundy777 9 месяцев назад +2

    Straight to the point, concise & informative! Brilliant explanation!!

    • @RootGames
      @RootGames  9 месяцев назад +1

      Thank you! 😉

  • @ThanhNguyen-gj1pm
    @ThanhNguyen-gj1pm 9 месяцев назад +2

    I went through your tutorials and it was so helpful that I decided to buy your course to support you.

    • @RootGames
      @RootGames  9 месяцев назад

      Thank you very much! I really appreciate it ❤️

  • @motero2k
    @motero2k 11 месяцев назад +2

    I really like your videos. This video is short but very useful. Awesome!

    • @RootGames
      @RootGames  11 месяцев назад

      Thank you! Glad you like them, more to come!

  • @richardrothkugel8131
    @richardrothkugel8131 4 месяца назад +2

    ISubscribe. You got me.

  • @gamesbyspinola
    @gamesbyspinola 11 месяцев назад +1

    really cool !! Very useful ! Thanks

    • @RootGames
      @RootGames  11 месяцев назад +1

      Thanks Spinola!

  • @stbnsnt
    @stbnsnt 5 месяцев назад

    Good! But it’s better to place OnTrigger event inside player

    • @RootGames
      @RootGames  5 месяцев назад +1

      Yes, you also do that! 😉

  • @Fyres11
    @Fyres11 7 месяцев назад

    It is indeed a way to do it, but what about going the other way around? You could put the OnTriggerEnter and Exit only once onto the player. When its in range of a trigger, set a bool _canInteract to true and _interactable = other.GetComponent(); (Set back to false and null in exit).

    • @RootGames
      @RootGames  7 месяцев назад

      Yes you also do it like that. Just note that then you lose some flexibility, because your collider for detecting interactables is always the same (on the player). In the way shown in the video, you can customize the colliders for each object as you wish/need.

    • @Fyres11
      @Fyres11 7 месяцев назад

      @@RootGames Oh no forgot to say the collider trigger is still on the objects. The main difference is instead of each objects getting the player component and sending their IInteractable to the player, the player get it itself.

  • @NoobProMaster01
    @NoobProMaster01 10 месяцев назад

    Can you make a tutorial for ground enemy chase trigger?

    • @RootGames
      @RootGames  10 месяцев назад +1

      I'm in the middle of creating a new course. Did you watch my flying enemy tutorial? It may give you an idea of how to do it.

  • @zeusdelolimpo2882
    @zeusdelolimpo2882 11 месяцев назад +2

    quee bien

    • @RootGames
      @RootGames  11 месяцев назад

      Thank you! 😉

  • @user-yu1hg8ql1t
    @user-yu1hg8ql1t 10 месяцев назад +1

    why doesn't my vs code report an error when not implementing the interface? should I type it down for each class?🥲