Calling Interface Functions In C++
I am trying to implement an interaction system via an interface but am having trouble figuring out how to call functions in my interface via C++. I am able to call these interface functions in Blueprints with the message nodes.
Some answers online talk about using Execute_* functions but I can't find any clear description on how to do this. I have tried casting with Cast<>() and InterfaceCast but these cause my project to crash.
Specifically, what I am trying to do is run a trace to see if there are any actors in front of the player pawn that implement my InteractableInterface. And then I want to be able to call the Interact(...) function on that actor. My InteractableInterface code is shown below.
Any help would be appreciated. Thanks very much
asked Jun 30 '15 at 05:25 AM in C++ Programming
answered Jun 30 '15 at 06:30 AM
Upon compilation I get Execute_Interact is not a member of IInteractableInterface. I found another error in my code and I was able to cast to IInteractable Interface successfully with Cast < InteractableInterface > (ActorRef);
Thanks for the input
I use them extensively, here's an example:
.h (blueprint callable interface, but implemented in c++)
another .h (Blueprint implementable events)
.cpp (tip: you can implement more than one interface in only 1 cpp, as u can see)
and here's how i call the functions:
Hope this helps you :)
Follow this question
Once you sign in you will be able to subscribe for any updates here