I’ve had a good search and haven’t found this specifically discussed anywhere so I though I might bring it up. I’ll start with a simple example.
Say we have a BaseActor and a DerivedActor that inherits from BaseActor. In the character blueprint, I would like to call a function from the BaseActor that could possibly be overridden by the DerivedActor. So the most obvious choice would be to add a function to the BaseActor and allow the DerivedActor to override it if needed. The character blueprint can then call the function on an instance of the actor in question.
I’ve recently been reading more about interfaces and event dispatchers, so I thought I’d apply them both to this simple example just to see how the implementation differs.
With an interface, I first have to create a Blueprint Interface with the desired function it in. Then in the BaseActor and/or the DerivedActor I can respond to the interface event when it is triggered on the Event Graph. The character blueprint can then call the interface function on an instance of the actor in question, just like calling a normal function.
With an event dispatcher, I first create the event dispatcher on the BaseActor. Then on the Event Graph of the BaseActor and/or the DerivedActor I can bind a function to the event that is called when the event is triggered. The character blueprint can then call the event dispatcher message on an instance of the actor in question, just like calling a normal function.
In conclusion. After trying out all three implementations for this simple example, it appears as though a simple Function Override is the way to go. The other two methods achieve the same result, but require more set up and don’t appear to offer any significant advantages. Do you think this is sound reasoning or am I missing something?
I would also be interested in hearing other people’s opinions on these options as I would really like to gain a deeper understanding of when each of these methods of implementation would be appropriate use.