Class UNetTransport
Inherited Members
Namespace: Unity.Netcode.Transports.UNET
Assembly: Unity.Netcode.Runtime.dll
Syntax
[AddComponentMenu("Netcode/UNet Transport")]
public class UNetTransport : NetworkTransport
  Fields
ConnectAddress
Declaration
public string ConnectAddress
  Field Value
| Type | Description | 
|---|---|
| string | 
ConnectPort
Declaration
public int ConnectPort
  Field Value
| Type | Description | 
|---|---|
| int | 
MaxConnections
Declaration
public int MaxConnections
  Field Value
| Type | Description | 
|---|---|
| int | 
MaxSentMessageQueueSize
Declaration
public int MaxSentMessageQueueSize
  Field Value
| Type | Description | 
|---|---|
| int | 
MessageBufferSize
Declaration
public int MessageBufferSize
  Field Value
| Type | Description | 
|---|---|
| int | 
MessageSendMode
Declaration
public UNetTransport.SendMode MessageSendMode
  Field Value
| Type | Description | 
|---|---|
| UNetTransport.SendMode | 
ServerListenPort
Declaration
public int ServerListenPort
  Field Value
| Type | Description | 
|---|---|
| int | 
Properties
ServerClientId
A constant clientId that represents the server
When this value is found in methods such as Send, it should be treated as a placeholder that means "the server"
Declaration
public override ulong ServerClientId { get; }
  Property Value
| Type | Description | 
|---|---|
| ulong | 
Overrides
Methods
DisconnectLocalClient()
Disconnects the local client from the server
Declaration
public override void DisconnectLocalClient()
  Overrides
DisconnectRemoteClient(ulong)
Disconnects a client from the server
Declaration
public override void DisconnectRemoteClient(ulong clientId)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ulong | clientId | The clientId to disconnect  | 
      
Overrides
GetCurrentRtt(ulong)
Gets the round trip time for a specific client. This method is optional
Declaration
public override ulong GetCurrentRtt(ulong clientId)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ulong | clientId | The clientId to get the RTT from  | 
      
Returns
| Type | Description | 
|---|---|
| ulong | Returns the round trip time in milliseconds  | 
      
Overrides
Initialize(NetworkManager)
Initializes the transport
Declaration
public override void Initialize(NetworkManager networkManager = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| NetworkManager | networkManager | optionally pass in NetworkManager  | 
      
Overrides
LateUpdate()
Declaration
protected void LateUpdate()
  PollEvent(out ulong, out ArraySegment<byte>, out float)
Polls for incoming events, with an extra output parameter to report the precise time the event was received.
Declaration
public override NetworkEvent PollEvent(out ulong clientId, out ArraySegment<byte> payload, out float receiveTime)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ulong | clientId | The clientId this event is for  | 
      
| ArraySegment<byte> | payload | The incoming data payload  | 
      
| float | receiveTime | The time the event was received, as reported by Time.realtimeSinceStartup.  | 
      
Returns
| Type | Description | 
|---|---|
| NetworkEvent | Returns the event type  | 
      
Overrides
Send(ulong, ArraySegment<byte>, NetworkDelivery)
Send a payload to the specified clientId, data and networkDelivery.
Declaration
public override void Send(ulong clientId, ArraySegment<byte> payload, NetworkDelivery networkDelivery)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ulong | clientId | The clientId to send to  | 
      
| ArraySegment<byte> | payload | The data to send  | 
      
| NetworkDelivery | networkDelivery | The delivery type (QoS) to send data with  | 
      
Overrides
Shutdown()
Shuts down the transport
Declaration
public override void Shutdown()
  Overrides
StartClient()
Connects client to the server
Declaration
public override bool StartClient()
  Returns
| Type | Description | 
|---|---|
| bool | Returns success or failure  | 
      
Overrides
StartServer()
Starts to listening for incoming clients
Declaration
public override bool StartServer()
  Returns
| Type | Description | 
|---|---|
| bool | Returns success or failure  |