Class NetCodeUtils
ToFixedString utilities for enums.
Inherited Members
Namespace: Unity.NetCode
Assembly: Unity.NetCode.dll
Syntax
public static class NetCodeUtils
Methods
ToFixedString(State)
Returns the Fixed String enum value name.
Declaration
public static FixedString32Bytes ToFixedString(this ConnectionState.State state)
Parameters
Type | Name | Description |
---|---|---|
Connection |
state | The source enum. |
Returns
Type | Description |
---|---|
Fixed |
Returns the Fixed String enum value name. |
ToFixedString(NetworkStreamDisconnectReason)
Returns the Fixed String enum value name.
Declaration
public static FixedString32Bytes ToFixedString(this NetworkStreamDisconnectReason reason)
Parameters
Type | Name | Description |
---|---|---|
Network |
reason | The source enum. |
Returns
Type | Description |
---|---|
Fixed |
Returns the Fixed String enum value name. |
ToFixedString(State)
Returns the Fixed String enum value name.
Declaration
public static FixedString32Bytes ToFixedString(this NetworkConnection.State state)
Parameters
Type | Name | Description |
---|---|---|
Network |
state | The source enum. |
Returns
Type | Description |
---|---|
Fixed |
Returns the Fixed String enum value name. |
ToNetcodeState(State, bool, bool)
Converts from the Transport state to ours.
Declaration
public static ConnectionState.State ToNetcodeState(this NetworkConnection.State transportState, bool hasHandshaked, bool hasApproval = true)
Parameters
Type | Name | Description |
---|---|---|
Network |
transportState | The source enum. |
bool | hasHandshaked | True if the handshake process has been completed. |
bool | hasApproval | True if (we have been approved AND the approval flow is enabled) OR if we don't need approval. |
Returns
Type | Description |
---|---|
Connection |
Netcode connection state |
Exceptions
Type | Condition |
---|---|
Argument |
If transport state is unknown. |