mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Update RemoteActions doc
This commit is contained in:
parent
e75b45f888
commit
a52d58a18b
@ -14,6 +14,8 @@ Commands are sent from player objects on the client to player objects on the ser
|
||||
|
||||
Commands functions must have the prefix “Cmd”. This is a hint when reading code that calls the command - this function is special and is not invoked locally like a normal function.
|
||||
|
||||
> Commands cannot be used directly as event handlers e.g. UI OnClick events, either by code or by inspector assignment. Create a separate method for the handler that calls the Command.
|
||||
|
||||
``` cs
|
||||
public class Player : NetworkBehaviour
|
||||
{
|
||||
@ -52,6 +54,8 @@ ClientRpc calls are sent from objects on the server to objects on clients. They
|
||||
|
||||
ClientRpc functions must have the prefix “Rpc”. This is a hint when reading code that calls the method - this function is special and is not invoked locally like a normal function.
|
||||
|
||||
> ClientRpc's cannot be used directly as event handlers e.g. UI OnClick events, either by code or by inspector assignment. Create a separate method for the handler that calls the ClientRpc.
|
||||
|
||||
``` cs
|
||||
public class Player : NetworkBehaviour
|
||||
{
|
||||
@ -81,6 +85,8 @@ TargetRpc functions are called by user code on the server, and then invoked on t
|
||||
|
||||
The first argument to an TargetRpc function must be a NetworkConnection object.
|
||||
|
||||
> TargetRpc's cannot be used directly as event handlers e.g. UI OnClick events, either by code or by inspector assignment. Create a separate method for the handler that calls the TargetRpc.
|
||||
|
||||
This example shows how a client can use a Command to make a request from the server (`CmdMagic`) by including its own `connectionToClient` as one of the parameters of the TargetRpc invoked directly from that Command:
|
||||
|
||||
``` cs
|
||||
|
Loading…
Reference in New Issue
Block a user