How would one raise an event on a clicked actor? I had an idea of raycasting to the character from a camera and checking if its an instance of Interactive then activate its public func but that seems botchy now when I know that in there somewhere there’s a built in function for a such thing. I was looking around but I couldn’t find a plain implementation of it or the one that compiled. Perhaps I was missing a header declaration or something. Any help is appreciated.
OnClicked is a delegate event
Delagate is equivalent of event dispatchers in blueprints, they exist so you can detect events from outside of object that event happanes because normal function call events can have code only in object they event triggers. In C++ it is variable in which you bind functions and when even happens (Broadcast or Execute is being called on delegate) it executes all binded functions to the delegate.
Since we dealing here with dynamic multi cast to bind a function you need to do this:
So for example (assuming we binding in same actor where target function is):
You can do binding in BeginPlay for example.
A good explanation of this topic with code examples is here: