I want to define a delegate, function, or other construct in a C++ class which I can call in C++ code and define as an event (like Tick) in a Blueprint subclass. For example, I want to do the following in C++
ACustomActor *Actor = SomeFunction();
Actor->OnEvent(Arg); // or OnEvent.Broadcast(Arg);
And be able to spawn, in the BP subclass of this actor, a Red Event
This works for the native Tick event and for Delegates I have defined in components, but not for delegates defined in the C++ Superclass or for overriding functions marked with the proper UFUNCTION attributes.
UFUNCTION(BlueprintImplementableEvent, Category = Behavior)
void OnEvent(FArg &Arg); // FArg is BlueprintType
All I can manage to do is override, and the override is missing the argument I defined and has it as a return value instead; when I defined my event as a delegate (or as an event) I could assign or bind to the event, but I could not get my code to print debug text when the event is called from C++. This leads me to believe that the blueprint editor has found the corresponding delegate Struct defined by the Macro and allows me instance it and bind it to other things, but it does not see the public member event which I called Broadcast
on in C++.
- How does Tick, which is a C++ function, provide an event like this in the blueprint? Or are they not really related?
- How are Blueprint function overrides different from a corresponding C++ function override? (Which requires the virtual and override keywords)