Incorrect RPC function behaviour on C++ Interface

Hi,
I have an interface with RPC client functions such as

UFUNCTION(Client, reliable)
virtual void Func();

Overriden by a class with
void Func_Implementation() override;
It all compiles and startup fine except the function is being run on listen server on testing.
i.e., 3x players will call this function 3 times on server. I can try moving the UFUNCTION def to implementing class but hoping there is a better way by keeping it in interface.

Edit: Updated categories to include networking

References to similar issues:
https://forums.unrealengine.com/t/interface-function-replication/

Thanks

Update:

I tested the same code using another rpc function on the implementing pawn class. The function was called from server using pawn class instead of interface. it worked as intended by running on the client.

The function ran incorrectly on server instead if I call Interface->Execute_Func(Pawn) from server.

RPC’s only work when called from owning actor.

RPC’s in an Interface class will not execute from clients → server. Interfaces are not owned by client actors. You have to either put the RPC in the Controller/Character (preferred) or in an actor that is outright owned by the character/controller.

Thanks,

Based on other forum/bug reports that’s what I assumed. Thanks for clarifying.
The build should assert if RPC functions are defined with interfaces to show that it is not supported.

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