Class UnityTransport
The Netcode for GameObjects NetworkTransport for UnityTransport. Note: This is highly recommended to use over UNet.
Implements
Inherited Members
Namespace: Unity.Netcode.Transports.UTP
Assembly: solution.dll
Syntax
[AddComponentMenu("Netcode/Unity Transport")]
public class UnityTransport : NetworkTransport, INetworkStreamDriverConstructor
Fields
Name | Description |
---|---|
ConnectionData | The connection (address) data for this UnityTransport instance. This is where you can change IP Address, Port, or server's listen address. UnityTransport.ConnectionAddressData |
DebugSimulator | Can be used to simulate poor network conditions such as:
|
InitialMaxPacketQueueSize | The default maximum (receive) packet queue size |
InitialMaxPayloadSize | The default maximum payload size |
InitialMaxSendQueueSize | The default maximum send queue size |
s_DriverConstructor | The global INetworkStreamDriverConstructor implementation |
Properties
Name | Description |
---|---|
ConnectTimeoutMS | Timeout in milliseconds indicating how long we will wait until we send a new connection attempt. |
DisconnectTimeoutMS | Inactivity timeout after which a connection will be disconnected. |
DriverConstructor | Returns either the global INetworkStreamDriverConstructor implementation or the current UnityTransport instance |
HeartbeatTimeoutMS | Timeout in milliseconds after which a heartbeat is sent if there is no activity. |
MaxConnectAttempts | The maximum amount of connection attempts we will try before disconnecting. |
MaxPacketQueueSize | The maximum amount of packets that can be in the internal send/receive queues. |
MaxPayloadSize | The maximum size of an unreliable payload that can be handled by the transport. |
MaxSendQueueSize | The maximum size in bytes of the transport send queue. |
Protocol | The current ProtocolType used by the transport |
ServerClientId | The client id used to represent the server. |
Methods
Name | Description |
---|---|
CreateDriver(UnityTransport, out NetworkDriver, out NetworkPipeline, out NetworkPipeline, out NetworkPipeline) | Creates the internal NetworkDriver |
DisconnectLocalClient() | Disconnects the local client from the remote |
DisconnectRemoteClient(ulong) | Disconnects a remote client from the server |
GetCurrentRtt(ulong) | Gets the current RTT for a specific client |
Initialize(NetworkManager) | Initializes the transport |
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. |
Send(ulong, ArraySegment<byte>, NetworkDelivery) | Send a payload to the specified clientId, data and networkDelivery. |
SetClientRelayData(string, ushort, byte[], byte[], byte[], byte[], bool) | Set the relay server data for the host. |
SetClientSecrets(string, string) | Set the client parameters for encryption. |
SetConnectionData(string, ushort, string) | Sets IP and Port information. This will be ignored if using the Unity Relay and you should call SetRelayServerData(string, ushort, byte[], byte[], byte[], byte[], bool) |
SetConnectionData(NetworkEndPoint, NetworkEndPoint) | Sets IP and Port information. This will be ignored if using the Unity Relay and you should call SetRelayServerData(string, ushort, byte[], byte[], byte[], byte[], bool) |
SetDebugSimulatorParameters(int, int, int) | Set the parameters for the debug simulator. |
SetHostRelayData(string, ushort, byte[], byte[], byte[], bool) | Set the relay server data for the host. |
SetRelayServerData(string, ushort, byte[], byte[], byte[], byte[], bool) | Set the relay server data for the server. |
SetRelayServerData(RelayServerData) | Set the relay server data (using the lower-level Unity Transport data structure). |
SetServerSecrets(string, string) | Set the server parameters for encryption. |
Shutdown() | Shuts down the transport |
StartClient() | Connects client to the server Note: When this method returns false it could mean:
|
StartServer() | Starts to listening for incoming clients Note: When this method returns false it could mean:
|