> For the complete documentation index, see [llms.txt](https://netick.gitbook.io/v1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://netick.gitbook.io/v1/remote-procedure-calls-rpcs.md).

# Remote Procedure Calls (RPCs)

RPCs are method calls on Network Behaviors that are replicated across the network. They can be used for events or to transfer data.

An important use of RPCs is to set up the game and send configuration messages. Use reliable RPCs for things like that.

An RPC example:

```csharp
[Rpc(source: RpcPeers.Everyone, target: RpcPeers.InputSource, isReliable: true, localInvoke: false)]
private void MyRpc(int arg1)
{
    // Code to be executed
}
```

You use the \[Rpc] attribute to mark a method as an RPC.

{% hint style="info" %}

1. RPCs are not called on restimulated ticks.
2. By default all RPCs are unreliable.
   {% endhint %}

**RPC method constraints:**

* Must have the return type of void.
* Must only include parameters that can be networked. Same ones as the properties

**\[Rpc] attribute parameters**

* Source: the peer/peers the RPC should be sent from
* Target: the peer/peers the RPC will be executed on
* isReliable: whether the RPC is sent reliably or unreliably
* localInvoke: whether to invoke the RPC locally or not

**Source and target can be any of the following:**

* Owner (the server)
* Input Source: the client which is providing inputs for this Network Object
* Proxies: everyone except the Owner and the Input Source
* Everyone: the server and every connected client

### Source Connection of RPCs <a href="#source-connection-of-rpcs" id="source-connection-of-rpcs"></a>

If you need to know which connection (a client, or the server) the current RPC is being executed from, you can use `Sandbox.RpcSource`

```csharp
[Rpc(source: RpcPeers.Everyone, target: RpcPeers.InputSource, isReliable: true, localInvoke: false)]
private void MyRpc(int arg1)
{
    var rpcSource = Sandbox.RpcSource;
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://netick.gitbook.io/v1/remote-procedure-calls-rpcs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
