docs.unity3d.com
    Show / Hide Table of Contents

    Class UnityTransport

    Inheritance
    Object
    UnityTransport
    Namespace: Unity.Netcode
    Syntax
    public class UnityTransport : NetworkTransport, INetworkStreamDriverConstructor

    Fields

    ConnectionData

    Declaration
    public UnityTransport.ConnectionAddressData ConnectionData
    Field Value
    Type Description
    UnityTransport.ConnectionAddressData

    DebugSimulator

    Declaration
    public UnityTransport.SimulatorParameters DebugSimulator
    Field Value
    Type Description
    UnityTransport.SimulatorParameters

    InitialMaxPacketQueueSize

    Declaration
    public const int InitialMaxPacketQueueSize = null
    Field Value
    Type Description
    Int32

    InitialMaxPayloadSize

    Declaration
    public const int InitialMaxPayloadSize = null
    Field Value
    Type Description
    Int32

    InitialMaxSendQueueSize

    Declaration
    public const int InitialMaxSendQueueSize = null
    Field Value
    Type Description
    Int32

    s_DriverConstructor

    Declaration
    public static INetworkStreamDriverConstructor s_DriverConstructor
    Field Value
    Type Description
    INetworkStreamDriverConstructor

    Properties

    DriverConstructor

    Declaration
    public INetworkStreamDriverConstructor DriverConstructor { get; }
    Property Value
    Type Description
    INetworkStreamDriverConstructor

    Protocol

    Declaration
    public UnityTransport.ProtocolType Protocol { get; }
    Property Value
    Type Description
    UnityTransport.ProtocolType

    ServerClientId

    Declaration
    public override ulong ServerClientId { get; }
    Property Value
    Type Description
    UInt64

    Methods

    CreateDriver(UnityTransport, out NetworkDriver, out NetworkPipeline, out NetworkPipeline, out NetworkPipeline)

    Declaration
    public void CreateDriver(UnityTransport transport, out NetworkDriver driver, out NetworkPipeline unreliableFragmentedPipeline, out NetworkPipeline unreliableSequencedFragmentedPipeline, out NetworkPipeline reliableSequencedPipeline)
    Parameters
    Type Name Description
    UnityTransport transport
    NetworkDriver driver
    NetworkPipeline unreliableFragmentedPipeline
    NetworkPipeline unreliableSequencedFragmentedPipeline
    NetworkPipeline reliableSequencedPipeline
    Implements
    INetworkStreamDriverConstructor.CreateDriver(UnityTransport, out NetworkDriver, out NetworkPipeline, out NetworkPipeline, out NetworkPipeline)

    DisconnectLocalClient()

    Declaration
    public override void DisconnectLocalClient()

    DisconnectRemoteClient(UInt64)

    Declaration
    public override void DisconnectRemoteClient(ulong clientId)
    Parameters
    Type Name Description
    UInt64 clientId

    GetCurrentRtt(UInt64)

    Declaration
    public override ulong GetCurrentRtt(ulong clientId)
    Parameters
    Type Name Description
    UInt64 clientId
    Returns
    Type Description
    UInt64

    Initialize(NetworkManager)

    Declaration
    public override void Initialize(NetworkManager networkManager = null)
    Parameters
    Type Name Description
    NetworkManager networkManager

    PollEvent(out UInt64, out ArraySegment<Byte>, out Single)

    Declaration
    public override NetworkEvent PollEvent(out ulong clientId, out ArraySegment<byte> payload, out float receiveTime)
    Parameters
    Type Name Description
    UInt64 clientId
    ArraySegment<Byte> payload
    Single receiveTime
    Returns
    Type Description
    NetworkEvent

    Send(UInt64, ArraySegment<Byte>, NetworkDelivery)

    Declaration
    public override void Send(ulong clientId, ArraySegment<byte> payload, NetworkDelivery networkDelivery)
    Parameters
    Type Name Description
    UInt64 clientId
    ArraySegment<Byte> payload
    NetworkDelivery networkDelivery

    SetClientRelayData(String, UInt16, Byte[], Byte[], Byte[], Byte[], Boolean)

    Set the relay server data for the host.

    Declaration
    public void SetClientRelayData(string ipAddress, ushort port, byte[] allocationId, byte[] key, byte[] connectionData, byte[] hostConnectionData, bool isSecure = false)
    Parameters
    Type Name Description
    String ipAddress

    IP address of the relay server.

    UInt16 port

    UDP port of the relay server.

    Byte[] allocationId

    Allocation ID as a byte array.

    Byte[] key

    Allocation key as a byte array.

    Byte[] connectionData

    Connection data as a byte array.

    Byte[] hostConnectionData

    Host's connection data as a byte array.

    Boolean isSecure

    Whether the connection is secure (uses DTLS).

    SetConnectionData(NetworkEndPoint, NetworkEndPoint)

    Sets IP and Port information. This will be ignored if using the Unity Relay and you should call SetRelayServerData(String, UInt16, Byte[], Byte[], Byte[], Byte[], Boolean)

    Declaration
    public void SetConnectionData(NetworkEndPoint endPoint, NetworkEndPoint listenEndPoint = null)
    Parameters
    Type Name Description
    NetworkEndPoint endPoint
    NetworkEndPoint listenEndPoint

    SetConnectionData(String, UInt16, String)

    Sets IP and Port information. This will be ignored if using the Unity Relay and you should call SetRelayServerData(String, UInt16, Byte[], Byte[], Byte[], Byte[], Boolean)

    Declaration
    public void SetConnectionData(string ipv4Address, ushort port, string listenAddress = null)
    Parameters
    Type Name Description
    String ipv4Address
    UInt16 port
    String listenAddress

    SetDebugSimulatorParameters(Int32, Int32, Int32)

    Set the parameters for the debug simulator.

    Declaration
    public void SetDebugSimulatorParameters(int packetDelay, int packetJitter, int dropRate)
    Parameters
    Type Name Description
    Int32 packetDelay

    Packet delay in milliseconds.

    Int32 packetJitter

    Packet jitter in milliseconds.

    Int32 dropRate

    Packet drop percentage.

    SetHostRelayData(String, UInt16, Byte[], Byte[], Byte[], Boolean)

    Set the relay server data for the host.

    Declaration
    public void SetHostRelayData(string ipAddress, ushort port, byte[] allocationId, byte[] key, byte[] connectionData, bool isSecure = false)
    Parameters
    Type Name Description
    String ipAddress

    IP address of the relay server.

    UInt16 port

    UDP port of the relay server.

    Byte[] allocationId

    Allocation ID as a byte array.

    Byte[] key

    Allocation key as a byte array.

    Byte[] connectionData

    Connection data as a byte array.

    Boolean isSecure

    Whether the connection is secure (uses DTLS).

    SetRelayServerData(String, UInt16, Byte[], Byte[], Byte[], Byte[], Boolean)

    Declaration
    public void SetRelayServerData(string ipv4Address, ushort port, byte[] allocationIdBytes, byte[] keyBytes, byte[] connectionDataBytes, byte[] hostConnectionDataBytes = null, bool isSecure = false)
    Parameters
    Type Name Description
    String ipv4Address
    UInt16 port
    Byte[] allocationIdBytes
    Byte[] keyBytes
    Byte[] connectionDataBytes
    Byte[] hostConnectionDataBytes
    Boolean isSecure

    Shutdown()

    Declaration
    public override void Shutdown()

    StartClient()

    Declaration
    public override bool StartClient()
    Returns
    Type Description
    Boolean

    StartServer()

    Declaration
    public override bool StartServer()
    Returns
    Type Description
    Boolean
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023