Ownership and net relevancy - Rejected requests

If I read the documentation right, if an actor is owned by Player Controller, then the client that this player controller is assigned to can call server functions on the actor.

It works in most cases. If I have a blueprint that is owned by a Player Controller directly, everything is fine. However, if I have a ownership tree it breaks and gives a warning:

LogRep:Warning: Rejected unwanted function XXX

I’ve found this topic:

Unfortunately none of the points seem to be my case. I only set the owner once, at the start. No matter how many times I try the result is the same, regardless of the time from start. Additionally, even on LogRep and LogNet set to VeryVerbose there is no additional information as to any reason of such behavior (I made sure I really well parsed that log file). I am trying to call it on a blueprint of a character. That’s how it looks:

  1. Character’s owner is Squad
  2. Squad’s owner is PlayerState
  3. PlayerState’s owner is PlayerController

In my case, if I try to call an RPC from the Character, I get the above warning and nothing works. However, if I only move the event I am calling to the Player Controller itself, everything works fine. I was hoping I could keep all the characters functionality inside character BP. Unfortunately, I have to re-route things through PC. If it helps, character, squad, player state and controller are all blueprints, not native classes.

To make sure the situation is clear: Client clicks something. Client’s input is handled on the client and the result of that input sooner or later brings me to the task of moving the character. Since the character’s blackboard is present only on the Host, I have to send the request to the host. And this is where it fails. The call gets rejected, no blackboard values are set and nobody moves.

The warning is being printed on the host log, not the client’s, which means that the request was sent and received.

It seems that when the package is received, there’s an IF statement (I forgot the actual lines, but I believe it goes something like this):

IF (!IsServer || IsNetOwner)

This one fails, because the Host does not own the character (the client who can control it does) and the packet is received on the host. Fail means reject. How am I supposed to do that then?

What is even more puzzling, is that my Building class has an owner of PlayerState, which means it’s only one branch shorter (the ownership tree), yet Building RPC’s work (by work I mean that I can call an RPC from the client that is fired on the host in the same blueprint I called from without any rerouting through PC). Maybe I’ve found a bug, or maybe I just don’t understand something. I’d gladly accept any help.

Are you spawning the Character on the client? The only reason I can think of here is that the character, with the same net guid, needs to exist on the server, so the server needs to have spawned it and had it replicate to the clients. It seems unlikely you’d be using SpawnActor on the client, but you never know…

I always issue the spawn request to the host. I progress some logic on the client to not force the host to do everything (progress bar for example), but then the building that spawns the character calls server RPC and the server spawns it, sets what needs to be set(including proper owner) and informs client that the unit exists (so it can reduce it’s resources by the amount it should only after it has confirmed the spawn).

Both the server and the client have the character, they both see it in the same position and all variables are replicated. If I do the same action on server it works. It is broken only when the client issues the order.