Unreal Engine 4 C++ Tutorial - Using Interfaces - UE4 / Unreal Engine 4 Intro to C++
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
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
Finally an understandable and nicely presented explanation about how to use interfaces in UE C++ :) Thank you!
Thank you and great to hear it's helped, Interfaces are very useful.
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!!!!
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.
Damn, my timing is usually a little better...
This video was exactly what I was looking for. Thanks!
Thank you for showing the C++ way struggled to find an example like this most videos were showing C++ interface just used in blueprint
Great Programming focused video for someone getting knowledge into Unreal engine C++. I hope you can make more like this.
OH MY GOD, YOU DESERVE SO MANY MORE SUBSCRIBERS!
Amazing tutorial
i wished you showed what file you were in at the top but this still helped greatly , thank you
Informative video about interfaces, thank you!
Thank you so much! It was really useful!
Very, very interesting. Thank you for this.
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
Nice
very helpful thank youu
very helpful.
love it.
thanks a lot.
very Simple!!! thank
Thank you! Wow
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.
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?
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
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)
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!
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
@@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.
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?
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!
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.
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.
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
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 🤷♀
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
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.
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.
@@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
@@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
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!
and what about if you need to pass some parameters
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...
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.
@@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.
First :)
How did you create these Cpp subfolders?
/"NameOfFolder" when creating a new class, after the default location and it works everything out for you past that.
@@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?
@@letenebrae3164 Nope, just the process I described there.
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