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

because you would want to abstract. you cant assume that it will be a component that implements the interface, you assume it is the actor itself (black box concept)

if 4 component implement the interface, it results logical that all of them should respond to the same message

That’s poor reasoning. If 100 actors in your world all implement the same interface, does that mean that all of them should get a call when you send that message? Absolutely not.

Are there some cases where this behavior makes sense? Probably.
But there are also cases where this behavior doesn’t make sense.
That means that it can’t be automatic behavior to forward messages that way.

If that’s the behavior that you want, you might consider a pub/sub messaging system like Lyra’s Gameplay Message Router plugin instead of interfaces.

1 Like

I am talking about components of an actor, which can be logically considered children of the actor. if the actor receives a message, it doesnt matter how many children it has, it is logical that the children also receive the message

This is quite illogical from the OOP point of view. Interface messaging works with individual instances, it’s explicit. It’s not a blanket message. If you want broadcasts - use dispatchers.

  • base actor class receives an Interface CallDispatch
  • base class component looks up its base class owner and registers with the abovementioned dispatcher

It’s the components’ job to register, the actor does not need to do anything and does not even need to know about the components’ existence; and they can be added / removed dynamically with no issues whatsoever. Each inheriting actor / component class can override the behaviour needed.


Don’t see it mentioned often. Subsystems are somewhat underutilised.

It really isn’t. Maybe for a specific use case it would be, but then you just make that use case work. Everynone’s suggestion with dispatchers is great, but so would manually iterating components and executing the same interface that the actor is implementing. It’s not how interface calls should work in the general case.

@Everynone

It probably doesn’t help that you can’t create them (easily) from blueprint. Who knows if that’s even a priority for anyone at Epic. Doesn’t particularly bother me, but it definitely reduces their visibility somewhat.