Class RpcTarget
Implementations of the various SendTo options, as well as additional runtime-only options
Single(ulong, RpcTargetUse),
Group(NativeArray<ulong>),
Group(NativeList<ulong>),
Group(ulong[]),
Group<T>(T), Not(ulong),
Not(NativeArray<ulong>),
Not(NativeList<ulong>),
Not(ulong[]), and
Not<T>(T)
Assembly: solution.dll
Syntax
Fields
ClientsAndHost
Send this RPC to all clients, including the host, if a host exists.
If the server is running in host mode, this is the same as Everyone.
If the server is running in dedicated server mode, this is the same as NotServer.
Declaration
public BaseRpcTarget ClientsAndHost
Field Value
Everyone
Send this RPC to everone, filtered to the current observer list.
Will execute locally.
Declaration
public BaseRpcTarget Everyone
Field Value
Me
Execute this RPC locally.
Normally this is no different from a standard function call.
Using the DeferLocal parameter of the attribute or the LocalDeferMode override in RpcSendParams,
this can allow an RPC to be processed on localhost with a one-frame delay as if it were sent over
the network.
Declaration
Field Value
NotMe
Send this RPC to everyone but the local machine, filtered to the current observer list.
Declaration
public BaseRpcTarget NotMe
Field Value
NotOwner
Send to everyone but the current owner, filtered to the current observer list.
Will execute locally if the local process is not the owner.
Declaration
public BaseRpcTarget NotOwner
Field Value
NotServer
Send to everyone but the server, filtered to the current observer list.
Will NOT send to a server running in host mode - it is still treated as a server.
If you want to send to servers when they are host, but not when they are dedicated server, use
ClientsAndHost.
Will execute locally if invoked on a client.
Will NOT execute locally if invoked on a server running in host mode.
Declaration
public BaseRpcTarget NotServer
Field Value
Owner
Send to the NetworkObject's current owner.
Will execute locally if the local process is the owner.
Declaration
public BaseRpcTarget Owner
Field Value
Server
Send to the server, regardless of ownership.
Will execute locally if invoked on the server.
Declaration
public BaseRpcTarget Server
Field Value
Methods
Dispose()
Declaration
Group(ulong[], RpcTargetUse)
Sends to a group of client IDs.
Constructing arrays requires garbage collected allocations. This override is only recommended
if you either have no strict performance requirements, or have the group of client IDs cached so
it is not created each time.
Declaration
public BaseRpcTarget Group(ulong[] clientIds, RpcTargetUse use)
Parameters
Type |
Name |
Description |
ulong[] |
clientIds |
|
RpcTargetUse |
use |
Temp will return a cached target, which should not be stored as it will
be overwritten in future calls to Not() or Group(). Do not call Dispose() on Temp targets.
Persistent will
return a new target, which can be stored, but should not be done frequently because it results in a GC allocation. You must call Dispose() on Persistent targets when you are done with them.
|
Returns
Group(NativeArray<ulong>, RpcTargetUse)
Sends to a group of client IDs.
NativeArrays can be trivially constructed using Allocator.Temp, making this an efficient
Group method if the group list is dynamically constructed.
Declaration
public BaseRpcTarget Group(NativeArray<ulong> clientIds, RpcTargetUse use)
Parameters
Type |
Name |
Description |
NativeArray<ulong> |
clientIds |
|
RpcTargetUse |
use |
Temp will return a cached target, which should not be stored as it will
be overwritten in future calls to Not() or Group(). Do not call Dispose() on Temp targets.
Persistent will
return a new target, which can be stored, but should not be done frequently because it results in a GC allocation. You must call Dispose() on Persistent targets when you are done with them.
|
Returns
Group(NativeList<ulong>, RpcTargetUse)
Sends to a group of client IDs.
NativeList can be trivially constructed using Allocator.Temp, making this an efficient
Group method if the group list is dynamically constructed.
Declaration
public BaseRpcTarget Group(NativeList<ulong> clientIds, RpcTargetUse use)
Parameters
Type |
Name |
Description |
NativeList<ulong> |
clientIds |
|
RpcTargetUse |
use |
Temp will return a cached target, which should not be stored as it will
be overwritten in future calls to Not() or Group(). Do not call Dispose() on Temp targets.
Persistent will
return a new target, which can be stored, but should not be done frequently because it results in a GC allocation. You must call Dispose() on Persistent targets when you are done with them.
|
Returns
Group<T>(T, RpcTargetUse)
Sends to a group of client IDs.
This accepts any IEnumerable type, such as List<ulong>, but cannot be called without
a garbage collected allocation (even if the type itself is a struct type, due to boxing).
This override is only recommended if you either have no strict performance requirements,
or have the group of client IDs cached so it is not created each time.
Declaration
public BaseRpcTarget Group<T>(T clientIds, RpcTargetUse use) where T : IEnumerable<ulong>
Parameters
Type |
Name |
Description |
T |
clientIds |
|
RpcTargetUse |
use |
Temp will return a cached target, which should not be stored as it will
be overwritten in future calls to Not() or Group(). Do not call Dispose() on Temp targets.
Persistent will
return a new target, which can be stored, but should not be done frequently because it results in a GC allocation. You must call Dispose() on Persistent targets when you are done with them.
|
Returns
Type Parameters
Not(ulong, RpcTargetUse)
Send to everyone EXCEPT a specific single client ID.
Declaration
public BaseRpcTarget Not(ulong excludedClientId, RpcTargetUse use)
Parameters
Type |
Name |
Description |
ulong |
excludedClientId |
|
RpcTargetUse |
use |
Temp will return a cached target, which should not be stored as it will
be overwritten in future calls to Not() or Group(). Do not call Dispose() on Temp targets.
Persistent will
return a new target, which can be stored, but should not be done frequently because it results in a GC allocation. You must call Dispose() on Persistent targets when you are done with them.
|
Returns
Not(ulong[], RpcTargetUse)
Sends to everyone EXCEPT a group of client IDs.
Constructing arrays requires garbage collected allocations. This override is only recommended
if you either have no strict performance requirements, or have the group of client IDs cached so
it is not created each time.
Declaration
public BaseRpcTarget Not(ulong[] excludedClientIds, RpcTargetUse use)
Parameters
Type |
Name |
Description |
ulong[] |
excludedClientIds |
|
RpcTargetUse |
use |
Temp will return a cached target, which should not be stored as it will
be overwritten in future calls to Not() or Group(). Do not call Dispose() on Temp targets.
Persistent will
return a new target, which can be stored, but should not be done frequently because it results in a GC allocation. You must call Dispose() on Persistent targets when you are done with them.
|
Returns
Not(NativeArray<ulong>, RpcTargetUse)
Sends to everyone EXCEPT a group of client IDs.
NativeArrays can be trivially constructed using Allocator.Temp, making this an efficient
Group method if the group list is dynamically constructed.
Declaration
public BaseRpcTarget Not(NativeArray<ulong> excludedClientIds, RpcTargetUse use)
Parameters
Type |
Name |
Description |
NativeArray<ulong> |
excludedClientIds |
|
RpcTargetUse |
use |
Temp will return a cached target, which should not be stored as it will
be overwritten in future calls to Not() or Group(). Do not call Dispose() on Temp targets.
Persistent will
return a new target, which can be stored, but should not be done frequently because it results in a GC allocation. You must call Dispose() on Persistent targets when you are done with them.
|
Returns
Not(NativeList<ulong>, RpcTargetUse)
Sends to everyone EXCEPT a group of client IDs.
NativeList can be trivially constructed using Allocator.Temp, making this an efficient
Group method if the group list is dynamically constructed.
Declaration
public BaseRpcTarget Not(NativeList<ulong> excludedClientIds, RpcTargetUse use)
Parameters
Type |
Name |
Description |
NativeList<ulong> |
excludedClientIds |
|
RpcTargetUse |
use |
Temp will return a cached target, which should not be stored as it will
be overwritten in future calls to Not() or Group(). Do not call Dispose() on Temp targets.
Persistent will
return a new target, which can be stored, but should not be done frequently because it results in a GC allocation. You must call Dispose() on Persistent targets when you are done with them.
|
Returns
Not<T>(T, RpcTargetUse)
Sends to everyone EXCEPT a group of client IDs.
This accepts any IEnumerable type, such as List<ulong>, but cannot be called without
a garbage collected allocation (even if the type itself is a struct type, due to boxing).
This override is only recommended if you either have no strict performance requirements,
or have the group of client IDs cached so it is not created each time.
Declaration
public BaseRpcTarget Not<T>(T excludedClientIds, RpcTargetUse use) where T : IEnumerable<ulong>
Parameters
Type |
Name |
Description |
T |
excludedClientIds |
|
RpcTargetUse |
use |
Temp will return a cached target, which should not be stored as it will
be overwritten in future calls to Not() or Group(). Do not call Dispose() on Temp targets.
Persistent will
return a new target, which can be stored, but should not be done frequently because it results in a GC allocation. You must call Dispose() on Persistent targets when you are done with them.
|
Returns
Type Parameters
Single(ulong, RpcTargetUse)
Send to a specific single client ID.
Declaration
public BaseRpcTarget Single(ulong clientId, RpcTargetUse use)
Parameters
Type |
Name |
Description |
ulong |
clientId |
|
RpcTargetUse |
use |
Temp will return a cached target, which should not be stored as it will
be overwritten in future calls to Single(). Do not call Dispose() on Temp targets.
Persistent will
return a new target, which can be stored, but should not be done frequently because it results in a GC allocation. You must call Dispose() on Persistent targets when you are done with them.
|
Returns