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:
- Character’s owner is Squad
- Squad’s owner is PlayerState
- 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.