Class ToServerAttribute
- Namespace
- Unity.Multiplayer.Core
Marks a partial void method on a NetEntity as a call from a client to the server (intent in, BIBLE
UM-LAW-1). Calling Move(p) anywhere sends it; the server runs the game's handler
void OnMove(<same parameters>, NetSender sender).
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class ToServerAttribute : Attribute
- Inheritance
-
ToServerAttribute
- Inherited Members
Remarks
The sending body and the transport stub (MoveServerRpc) are generated (RFC 0001). The handler may leave
out the trailing NetSender when it does not need it. Before the handler runs, the server checks ownership
(RequireOwnership) and the sender's rate (RateLimit); a call that fails either is
dropped and reported, never handled.
A host calling it on itself runs the handler locally with the host as the sender.
Properties
Burst
How many calls a sender may make back to back before RateLimit applies (the bucket's size). 0, the default, means one second's worth: the same as RateLimit.
public int Burst { get; set; }
Property Value
Delivery
Reliable (default) or unreliable.
public Delivery Delivery { get; set; }
Property Value
RateLimit
The most calls per second the server accepts from one sender for this RPC (a token bucket refilled at this rate). 0, the default, means no limit.
public int RateLimit { get; set; }
Property Value
RequireOwnership
True (the default): only the client that owns the entity may call it; anyone else's call is dropped. False lets any connected client call it (a shared button, a vote).
public bool RequireOwnership { get; set; }