Unreal Engine 4 C++ Tutorial - Using Interfaces - UE4 / Unreal Engine 4 Intro to C++

Sdílet
Vložit
  • čas přidán 21. 08. 2024
  • This Video:
    In this video, we look at the use of Interfaces in C++, how to create, implement and send messages through Interface functions.
    Intro to C++:
    Intended to be the true intro to C++ for UE4. This playlist is intended to focus on one topic at a time and explain how, why and when they work. Think of it as documentation in video form.
    Chapters:
    00:00
    00:10 - Intro
    01:15 - Creating Interfaces
    02:08 - Interface Header
    03:41 - Character Header
    05:23 - Character Code
    06:25 - Calling Interfaces
    11:22 - Testing Results
    Consider supporting the channel on Patreon: / devenabled
    Links:
    Download free projects from complete tutorial series and more: mega.nz/#F!imQ...
    Join the Dev Enabled Discord: / discord
    Get my new UE4 Beginners course: devenabled.tea...
    Beginner course now available on Udemy: www.udemy.com/...
    Gamedev.tv Courses - Affiliate Links:
    Unreal C++ Developer: www.gamedev.tv...
    Unreal Multiplayer: www.gamedev.tv...
    Unreal Blueprints: www.gamedev.tv...
    Blender Characters: www.gamedev.tv...
    Get a FREE Pluralsight trial and support the channel: pluralsight.px...
    My First Pluralsight Course: pluralsight.px...
    My Second Pluralsight Course: pluralsight.px...
    My Third Pluralsight Course: pluralsight.px...
    Check out my Website: devenabled.com/
    Twitter: / robbcreates
    RECOMMENDED READING - Game Theory Books -
    Theory of Fun for Game Design: amzn.to/2Y7a29z (Personal Favourite)
    Game Feel: A Game Designer's Guide to Virtual Sensation: amzn.to/3159Dl5 (Another read I couldn't put down)
    Level Up! The Guide to Great Video Game Design: amzn.to/2MkxcC8
    The Art of Game Design, Second Edition: amzn.to/2JY6EVz
    Rules of Play: Game Design Fundamentals: amzn.to/2YcfsA7
    Game Programming Patterns: amzn.to/2YbXnC2
    Drawing Basics and Video Game Art: amzn.to/2Ml6FVb
    Sound Effects (BFXR): www.bfxr.net/
    Get Affinity Designer: affinity.serif...
    Get Unreal: www.unrealengi...
    Get Some great free assets here: www.gamedevmar...
    #ue4, #unreal_engine, #Cpp, #interface

Komentáře • 53

  • @DevEnabled
    @DevEnabled  Před 3 lety +3

    Get my new UE4 Beginners course: devenabled.teachable.com/p/intro-to-ue4/
    Beginner course now available on Udemy: www.udemy.com/course/unreal-engine-4-ue4-complete-beginners-course/?referralCode=FB8E232D20F4A087F6D5

  • @seahawk913
    @seahawk913 Před 2 lety +4

    Finally an understandable and nicely presented explanation about how to use interfaces in UE C++ :) Thank you!

    • @DevEnabled
      @DevEnabled  Před 2 lety

      Thank you and great to hear it's helped, Interfaces are very useful.

  • @matrixcn73271
    @matrixcn73271 Před rokem +1

    Incredible tutorial. I was banging my head just trying to figure out how to properly use these. It's hard to find really good information. Thank you so much! You're a great teacher!!!!

  • @jevinscherries
    @jevinscherries Před 3 lety +4

    Where was this earlier this week when I was implementing an interface in C++ :D Thanks for the knowledge, and keep up the good work.

    • @DevEnabled
      @DevEnabled  Před 3 lety +1

      Damn, my timing is usually a little better...

  • @qcgeneral29
    @qcgeneral29 Před 2 lety +2

    This video was exactly what I was looking for. Thanks!

  • @ockertnel2458
    @ockertnel2458 Před rokem

    Thank you for showing the C++ way struggled to find an example like this most videos were showing C++ interface just used in blueprint

  • @giovannisierra112
    @giovannisierra112 Před rokem

    Great Programming focused video for someone getting knowledge into Unreal engine C++. I hope you can make more like this.

  • @noctua7771
    @noctua7771 Před 3 lety

    OH MY GOD, YOU DESERVE SO MANY MORE SUBSCRIBERS!

  • @Muhammad_Abdullah_Sultan
    @Muhammad_Abdullah_Sultan Před 3 lety +1

    Amazing tutorial

  • @God0fTime
    @God0fTime Před rokem +1

    i wished you showed what file you were in at the top but this still helped greatly , thank you

  • @reiderjack7531
    @reiderjack7531 Před 2 lety

    Informative video about interfaces, thank you!

  • @Dronium1
    @Dronium1 Před 2 lety +1

    Thank you so much! It was really useful!

  • @aleca8910
    @aleca8910 Před 2 lety

    Very, very interesting. Thank you for this.

  • @milos_slav_sky
    @milos_slav_sky Před 3 měsíci

    The difference between methods is that you couldn't use the second one with Blueprint classes, which don't inherit interfaces, but just implement them. This way they just couldn't interact, even if they implement Interact function in their Blueprints properly

  • @theFishy_
    @theFishy_ Před 3 lety +1

    Nice

  • @Nanakoglasgow
    @Nanakoglasgow Před rokem

    very helpful thank youu

  • @igotbit9454
    @igotbit9454 Před 2 lety

    very helpful.
    love it.
    thanks a lot.

  • @heavyrainstudio5798
    @heavyrainstudio5798 Před 3 lety

    very Simple!!! thank

  • @kyrylokravchuk9933
    @kyrylokravchuk9933 Před 2 lety

    Thank you! Wow

  • @yrussq
    @yrussq Před 3 lety

    Nice!
    It would not hurt to mention and point out specifically and unequivocally that "_implementation" suffix and "execute_" prefix is a UE only thing. It's counterintuitive why you've declared one function names in the interface while implementing the others in the class. Implementation is a programming term, the fact the Epics reinventing the way the language works and use the programming terms frivolously for their own amusement is really getting on my nerves.

  • @thehambone1454
    @thehambone1454 Před 11 měsíci

    Amazing, thank you, I was looking for literally this. I needed a way to generically interact with different type of objects, I guess this is common in gamedev ;). Does this work exactly the same in UE5?

  • @ginkerzo8954
    @ginkerzo8954 Před 3 lety +1

    Really nice video, good job !
    I have a little question if it is not bothering you,
    In character.h I would have done virtual void OnInteract_Implementation() for override in BP the function like you have done in your tutorials about interface and not void OnInteract_Implementation() override for the blueprint case.
    Why this difference between this video and the tuto ?
    Thanks again for your time and explanations

  • @sotanaht13012
    @sotanaht13012 Před 2 lety

    I think that if you try to store in a IInteractInterface a blueprint that implements that interface, it cannot work : blueprints implementing this do not really implement that interface, they just mimic it and that's why we have to use the execute_ and implements interface stuff
    If you implemented the interface in CPP thought no problem but keep in mind that the interface is available to any data creator (unless not blueprint able I think)

  • @jalsiddharth
    @jalsiddharth Před 3 lety +1

    I think I got this. Can we have a more detailed video with practical examples?
    Please correct my understanding. You create an interface which your character class implements.
    Then you cast to type interfaceclassname and as long as the cast is successful you are able to call the functions from the interface.
    Why am i going through this headache? Is the idea to avoid lots of includes and casts and checks to be able to call character specific functions? Or did all this just go over my head?
    Thanks Rob!

    • @DevEnabled
      @DevEnabled  Před 3 lety +1

      Pretty much, plus the reasons I mention in the video. It creates a more agnostic class structure with fewer dependencies. It can open opportunities for emergent gameplay with completely unique classes sharing similar functionalities.
      It's a slightly older playlist but I have covered Interfaces in context of a slightly larger project so that might help here: czcams.com/play/PL9z3tc0RL6Z4JJS__Bge8O2mLwKUaG1eU.html

    • @jalsiddharth
      @jalsiddharth Před 3 lety

      @@DevEnabled thank you so much. I get it now. :) Had a request. Can you make a tutorial on using damage type classes in C++? :) I'm a bit confused as to how to use it other than enums but still that doesn't make sense as we end up creating multiple damage type classes just for enum. There has to be more.

  • @GeNN18192
    @GeNN18192 Před 2 lety

    Thanks for the exlanation. Is it a practice in unreal to have actual default implementation in the interface.cpp? Or is that not a thing?

  • @cafo5997
    @cafo5997 Před 3 lety

    Question: in this way can we implement a "default behaviour" any class that implements the interface should have if the virtual function is not overridden? I think no, beacuse the initial function declaration is virtual pure( = 0 ).
    Any workaround to this fact?
    The only thing that come to my mind is to implement a default behaviour for every parent class we want to implement the interface in, going to specify more to his children. But this still asks you to implement a default behaviour every time, at least in the "top" classes.
    Really good video my man, keep up the good work!

    • @DevEnabled
      @DevEnabled  Před 3 lety +2

      Thanks. I think what you're looking for is leaning back more on inheritance, so like you said having a base class that implements the interface and has a default use of the interface function that all child classes will inherit and override if needed.

  • @mattgraves3709
    @mattgraves3709 Před 3 lety

    Is this playlist /series the more comprehensive?
    I really like your content and have learned a lot so far.
    Thank you so much for making this dev a bit more enabled.

    • @UnrealogyTutorials
      @UnrealogyTutorials Před 3 lety

      This is a quadrilateral formed by reversing the charge of proton pump inhibitor of the elements of the eternal cosmos bank account details are scammed by tech support scammer

  • @tommiemartin1596
    @tommiemartin1596 Před 6 měsíci

    In 5.3 I get duplicate symbol linker errors if I have the _Implementation functions in the class that gets the Interface. Works fine withou them 🤷‍♀

  • @SurviveOnlyStrong
    @SurviveOnlyStrong Před 2 lety

    Hello, how can I expose a c++ interface method to the blueprints as a message?
    So I can call it via blueprints without casting.
    Currently I can call it only as a function

  • @gamescreator5040
    @gamescreator5040 Před 3 lety

    HI! I really like your videos, thanks a lot! Definitely like from me. They are very useful for me as for unity developer. And it would be good see from you videos about SOLID in Unreal engine 4.

    • @DevEnabled
      @DevEnabled  Před 3 lety

      That's great to hear thank you. If you haven't seen it already be sure to check out the Unity to Unreal playlist on the channel if that's where you're coming from.
      I'm not too sure what SOLID is in Unreal though.

    • @gamescreator5040
      @gamescreator5040 Před 3 lety

      @@DevEnabled I think solid is same everywhere. But in Unity for example We can easily create a non MonoBehaviour class for something, but I don't sure how to do this in Unreal. I Mean it would be good in general to see from you little game architecture with pure OOP approach. Because there is lack of good c++ tutorials on CZcams. Only blueprint stuff

    • @UnrealogyTutorials
      @UnrealogyTutorials Před 3 lety

      @@gamescreator5040 The Small Intestine to the rescue the depressed and the Bois a good day please find attached the same the answers the questions ☺️ rufutu the same 🐱 to have enough time to complete electromagnetic radiation therapy in the last word

  • @ikanuutinen
    @ikanuutinen Před 3 lety

    EDIT: Breaking the link between InputAction Interact and LineTraceByChannel fixed the issue.
    Hey! I'm following your old UE4 C++ series and i ran in to an issue with the interface. The debug traces and object focus work, but the Destroy() command does nothing. I can't manage to figure out a way to destroy the object even though i've followed the code in the tutorial in every part. It shows that my inputs are being registered, but the removal of the object i can't figure out. No error messages either. I'm thinking that there could be an issue with the destroy command not being actived from the Input_Implementation line. Any ideas for solutions to try or other ways to recreate it? Thanks for the help!

  • @MegaMitrandir
    @MegaMitrandir Před 3 lety

    and what about if you need to pass some parameters

  • @ajk7733
    @ajk7733 Před 3 lety

    I noticed that you are using rider, may i ask you how you got it working with the current version of UE4 ? The plugin comes now with UE4 and is enabled by default, however i can't pick rider from the IDE selection menue...

    • @DevEnabled
      @DevEnabled  Před 3 lety

      Unfortunately, I don't remember having any issues with it in 4.25 or 4.26. I've just installed it to the engine version through the Epic Launcher and selected it as the IDE in the project settings. Could be that you just need to uninstall/reinstall it and under File click Refresh Rider project, if you see that option.

    • @ajk7733
      @ajk7733 Před 3 lety

      @@DevEnabled thank you for your quick answer, for some reason it's still not working for me. The plugin is activated but Rider isn't showing up in the IDE list, Visual Studio, VS Code and Clion are there but no Rider. I guess i will have to contact the support.

  • @karthikeyas5753
    @karthikeyas5753 Před 3 lety

    First :)

  • @letenebrae3164
    @letenebrae3164 Před 3 lety

    How did you create these Cpp subfolders?

    • @DevEnabled
      @DevEnabled  Před 3 lety +1

      /"NameOfFolder" when creating a new class, after the default location and it works everything out for you past that.

    • @letenebrae3164
      @letenebrae3164 Před 3 lety

      @@DevEnabled Ok. And this new folder has to be created from the IDE before creating the class itself in the UE Content or dont need to?

    • @DevEnabled
      @DevEnabled  Před 3 lety +1

      @@letenebrae3164 Nope, just the process I described there.

  • @davedumas0
    @davedumas0 Před 3 lety

    can you make a tutorial series on remaking this game in UE4
    czcams.com/video/RkoNHEwvftI/video.html
    with a standard controls(that was the games main issue was control scheme was weird)
    the name of the game is "NOCTIS" the premise is millions or billions of years after present day a race of cat people that was exploring the galaxy and the galaxies state is after the merger between Andromeda and the milky way and after earth is LONG GONE