No input received on replicated item component

I’m trying to add a component to an actor in multiplayer using a Listen Server. The component is set to replicate and I’m adding the component to the actor through the server (as you can see with the HasAuthority check). However, when I add the component through the “TestEvent”, the component cannot receive input from the enhanced input system if I’m on the client. On the server though it works fine. If I add it through the “BeginPlay” event, it works fine. They are using the exact same add node, so I don’t understand why the result is different. I’ve confirmed that the client is getting the component through replication, it just isn’t receiving input.

Adding the component through the player blueprint. Doing it through test event doesn’t work for the client player, but works for the server player. Doing it through BeginPlay works for both. (note: when testing they aren’t both hooked up to the add node at the same time)

This is in the component blueprint. I’m just displaying a message on “Action” (mouse click), but only when the component is added to the server player does it register. If the component is added to the client player, it won’t register.
image

Why is this the case? If both methods are going through the server and adding it using the exact same node, why can only the server player receive input through the component when added through TestEvent?

Thanks!

If I add a timer to the BeginPlay path, then it no longer works. So it has something to do with the client not being connected yet when the BeginPlay path runs, because if I wait for the client to connect, it doesn’t work.

Going off this thread: How to register to receive input events from dynamically added components?
It seems that dynamically added components cannot pick up input. I couldn’t find a straight answer if components should pick up input at all, but what did become apparent is that it is bad design to receive input through components. It should only be done on widgets, controlled pawns, and controllers. Which may be why it is unreliable on components.
I’m not 100% on this though, so not going to mark this as answer. But, thought it might be useful for someone in the future to know what I found.

TLDR: It is bad design to get input on components and isn’t designed for that, so even if I could get it to work, I shouldn’t.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.