Promotion of interfaces from actor components

Will interfaces be automatically used in actors with actor components where they are implemented? i added an interface into an actor component, added the component into an actor, but it’s not shown in the list of all interfaces.

No, you’d need to propagate from actor → component. Or call it on the component directly.


Alternatively, the components could register with the actor’s dispatcher, called when the message is received. Not sure if that would make much sense. Maybe in some fringe case scenario?

So what’s the Unreal way of thinking here, because to me this feels backwards.

If I add a component to an actor that component should naturally extend the actor’s behavior in some way, right?

So why shouldn’t it automatically listen to any and all interface messages the actor receives?

Why do I explicitly have to call the specific component that listens to an interface?

This dance feels very silly to have to do (and specifically lots of unnecessary nodes to add whenever you want to send an interface message to a component) and it doesn’t feel very generic or convenient, which interfaces are supposed to be:

I hope I’ve misunderstood something here, but I sadly don’t think so.

Because components aren’t unique. If an actor has 4 components that all implement the same interface how do you know that all of them should respond to that specific message at that specific time.

If it feels silly to do, it’s probably because it is. If the Actor doesn’t actually implement the interface (because it just passes through to the components), why should anyone be calling the interface function on it? If it’s a component interface, then the code that is sending the message should be getting the components somehow to dispatch instead of dispatching through the actor.
Otherwise your interface will only ever work the way you expect it to when your working with a custom actor that implements your pass-through logic.

1 Like