I have a function in my custom playercontroller that I need to be called on both the client and the server. I can’t use NetMulticast because other playercontrollers don’t exist on the clients and so using NetMulticast causes a bunch of issues. I tried something like UFUNCTION(Client, Server, WithValidation, reliable)
but that only seems to call it on the client. The only solution I can think of is to have two identical functions, one UFUNCTION(Client, WithValidation, reliable)
and the other UFUNCTION(Server, WithValidation, reliable)
and always call both, but I don’t like that solution.
This doesn’t answer the actual question I posed, but the solution that I realize is probably the proper solution is to call the function on the server and replicate the results to the client.
To be more specific, I had variables that I was trying to update on both the client and the server, so instead I update them on the server and replicate the variables (using UPROPERTY).
That sounds like a good idea. Also there is a way to execute a function only on the client that owns a certain connection, but you said the problem was the target client wouldn’t have a playercontroller to own that connection or something like that.