Struct ApprovalDecision
- Namespace
- Unity.Multiplayer.Core
The server's answer to a connection request: approved with the decoded payload, or rejected with an ApprovalRejection and a sentence the client can show the player.
public readonly struct ApprovalDecision
- Inherited Members
Properties
Approved
True when the connection may proceed.
public bool Approved { get; }
Property Value
Message
A sentence for the player; empty when approved.
public string Message { get; }
Property Value
Payload
The decoded payload when it could be read (always when approved; null for most BadPayload cases).
public ConnectionPayload Payload { get; }
Property Value
Rejection
Why the connection was rejected, or None.
public ApprovalRejection Rejection { get; }
Property Value
Methods
Approve(ConnectionPayload)
An approval carrying the client's payload.
public static ApprovalDecision Approve(ConnectionPayload payload)
Parameters
payloadConnectionPayload
Returns
Exceptions
- ArgumentNullException
payloadis null.
Reject(ApprovalRejection, string, ConnectionPayload)
A rejection with its reason and message.
public static ApprovalDecision Reject(ApprovalRejection rejection, string message, ConnectionPayload payload = null)
Parameters
rejectionApprovalRejectionmessagestringpayloadConnectionPayload
Returns
Exceptions
- ArgumentException
rejectionis None or undefined.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
ToWireReason()
The reason string the transport sends back with a refused connection: "<Rejection>|<message>",
or empty when approved. TryParseWireReason(string, out ApprovalRejection, out string) reads it on the client.
public string ToWireReason()
Returns
TryParseWireReason(string, out ApprovalRejection, out string)
Reads a reason string written by ToWireReason(). False for empty or foreign text, in which
case message holds the raw text so it can still be shown.
public static bool TryParseWireReason(string reason, out ApprovalRejection rejection, out string message)
Parameters
reasonstringrejectionApprovalRejectionmessagestring