Class RpcAttribute
Marks a method as a remote procedure call (RPC).
The marked method will be executed on all game instances defined by the SendTo target.
Inherited Members
Namespace: Unity.Netcode
Assembly: Unity.Netcode.Runtime.dll
Syntax
[AttributeUsage(AttributeTargets.Method)]
public class RpcAttribute : Attribute
Constructors
RpcAttribute(SendTo)
Initializes a new instance of the RpcAttribute with the specified target
Declaration
public RpcAttribute(SendTo target)
Parameters
| Type | Name | Description |
|---|---|---|
| SendTo | target | The target for this RPC |
Fields
AllowTargetOverride
When true, allows the RPC target to be overridden at runtime
Declaration
public bool AllowTargetOverride
Field Value
| Type | Description |
|---|---|
| bool |
DeferLocal
When true, local execution of the RPC is deferred until the next network tick
Declaration
public bool DeferLocal
Field Value
| Type | Description |
|---|---|
| bool |
Delivery
Type of RPC delivery method
Declaration
public RpcDelivery Delivery
Field Value
| Type | Description |
|---|---|
| RpcDelivery |
InvokePermission
Controls who has permission to invoke this RPC. The default setting is Everyone
Declaration
public RpcInvokePermission InvokePermission
Field Value
| Type | Description |
|---|---|
| RpcInvokePermission |
RequireOwnership
When true, only the owner of the object can execute this RPC
Declaration
[Obsolete("RequireOwnership is deprecated. Please use InvokePermission = RpcInvokePermission.Owner or InvokePermission = RpcInvokePermission.Everyone instead.")]
public bool RequireOwnership
Field Value
| Type | Description |
|---|---|
| bool |
Remarks
Deprecated in favor of InvokePermission.