How is ClientRpc Calls executed on the client?
I'm using Mirror which I think is the old HLAPI from UNET. When I tried to figure out how these types of call works I use these 2 piece of code.
private void Start() { if (!hasAuthority) return; RpcDestroySelf(); }
and
private void Start() { if (!hasAuthority) return; CmdDestroySelf(); }
where each of the xxxDestroySelf()
call have this.gameObject.SetActive(false);
When using Rpc calls, both the server and client see nothing.
When using Cmd calls, the client sees the server's object.
In my understanding, when a code is flagged Rpc, the client side will execute nothing when calling the function, and only sets up listeners for the server's call.
When flagged Cmd, the function will run on the client side first, the server listens to the client's call and broadcast to all other clients.
My question is, why is RpcDestroySelf()
called on the client side for the Server's object? That piece of code already got executed before the client joins the game, why is the server's object still destroyed on the client side?
Your answer
Follow this Question
Related Questions
Trouble spawning objects on server in Mirror 0 Answers
Mirror - attribute assigned to server, but not client. 0 Answers
[Mirror Networking] How can i add a NetworkRigidbody component to an object ? 0 Answers
Multiplayer Networking Leap Motion with Mirror 1 Answer
[Forum bugged, can't delete] 0 Answers