Function Node.rpc
Sends a remote procedure call request for the given method
to peers on the network (and locally), optionally sending all additional arguments as arguments to the method called by the RPC. The call request will only be received by nodes with the same NodePath
, including the exact same node name. Behaviour depends on the RPC configuration for the given method, see rpcConfig
. Methods are not exposed to RPCs by default. See also rset
and rsetConfig
for properties. Returns an empty Variant
.
Note: You can only safely use RPCs on clients after you received the connected_to_server
signal from the SceneTree
. You also need to keep track of the connection state, either by the SceneTree
signals like server_disconnected
or by checking SceneTree
.