RPC - strange behaviour (client to server)

Hey everyone!

I’m getting strange behaviour of running RPCs and variable replication on ActorComponent based class. Owning actor and the component are marked as replicated btw.
I’m trying to call the function below on the server (commented line)

Log outputs this:
When calling the function from the client:

Local role: 1, remote role: 3

When calling the function from the server:

Local role: 3, remote role: 2

Header file looks like this
image

To be sure I tried to print something but nothing happened

If I understand RPCs correctly when I call the function from the server both logs should be printed, right?
And If I call it from the server only the server log should be printed.

I used UE 4.27.2.

I’ll be glad for any help!
Thank you!

If you call BeginRevive from the client, then ServerBeginRevive should be called unless there is an issue with IsInlastStand() or IsRevivingInProgress() and it returns early or perhaps you have not setup the function properly with adding ServerBeginRevive_Validate function?

If you call BeginRevive from the server then it should not call ServerBeginRevive because it’s local role is not < ROLE_Authority (ROLE_Authority = 3).

Thank you for your reply. There is no problem with IsInlastStand() or IsRevivingInProgress() I checked that multiple times. Validate function returning directly true.

I called BeginRevive() function on client-side so it should be called.

Addition:

I tried to call RPC in blueprint and this appeared:

LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_CharacterV2_C_1. Function ServerSetCameraRotation will not be processed.

If I try to replicate the variable (server → clients) OnRep is not called at all.

Also, I read here that it has to do something with pawn possession. I didn’t modify default spawning/possessing of pawns.

Hmm unfortunately im out of ideas, you sure your playercontroler has possesion of the pawn?
Perrhaps the issue is in your controller or character setup somewhere.

May I suggest that you make an empty barebones project with just a simple RPC so I can try and perhaps pinpoint where the issue is? dunno how else I might help, I would just be guessing.

Thank you for your advice!

In the end, I figured out the problem. I was trying to call BeginRevive function on an object that wasn’t in client ownership…

I’ve been trying to solve this for two days and end up with this easy solution. :frowning: