In your code you call the Command if you are the server, and call the RpcCall if you are not the server. It works the other way around:
- Commands are issued from the client to the server.
- RpcCalls are called from the server to all clients.
So if you are the server, you should call the RpcCall. And if you are the client, you should send a command to the server, requesting the RpcCall.
Just change:
if (isServer)
To:
if (!isServer)
As you are currently using them the other way around.
I'd suggest also suggest, if possible, implement the RpcCall and Command in the ControllerColliderHit class, so you don't have to pass the component as a parameter, which might increase the size of the messages between clients and the server. Also the code would be clearer to read IMO.