# Incorrect RPC function behaviour on C++ Interface

**URL:** <https://forums.unrealengine.com/t/incorrect-rpc-function-behaviour-on-c-interface/1665968>\
**Category:** Multiplayer & Networking\
**Tags:** bug, rpc, unreal-engine, question, CPP\
**Created:** [February 4, 2024, 6:30pm UTC](https://forums.unrealengine.com/t/incorrect-rpc-function-behaviour-on-c-interface/1665968 "2024-02-04T18:30:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![asbe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@asbe](https://forums.unrealengine.com/u/asbe)\
**Post date:** [February 4, 2024, 6:30pm UTC](https://forums.unrealengine.com/t/incorrect-rpc-function-behaviour-on-c-interface/1665968/1 "2024-02-04T18:30:31Z")

</div>

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

```auto
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/](https://forums.unrealengine.com/t/interface-function-replication/)

> **[The Unreal Engine Issues and Bug Tracker](https://issues.unrealengine.com/issue/UE-16910)**
>
> Welcome to the Unreal Engine Issue and Bug Tracker. You can check the status of an issue and search for existing bugs. See latest bug fixes too.

Thanks

---

<div class="post-metadata">

**Author:** ![asbe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@asbe](https://forums.unrealengine.com/u/asbe)\
**Post date:** [February 5, 2024, 10:17am UTC](https://forums.unrealengine.com/t/incorrect-rpc-function-behaviour-on-c-interface/1665968/2 "2024-02-05T10:17:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [February 5, 2024, 7:50pm UTC](https://forums.unrealengine.com/t/incorrect-rpc-function-behaviour-on-c-interface/1665968/3 "2024-02-05T19:50:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![asbe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@asbe](https://forums.unrealengine.com/u/asbe)\
**Post date:** [February 6, 2024, 10:50pm UTC](https://forums.unrealengine.com/t/incorrect-rpc-function-behaviour-on-c-interface/1665968/4 "2024-02-06T22:50:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [March 7, 2024, 10:50pm UTC](https://forums.unrealengine.com/t/incorrect-rpc-function-behaviour-on-c-interface/1665968/5 "2024-03-07T22:50:52Z")

</div>

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