docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class DefaultDriverBuilder

    Default helper method implementation for constructing NetworkDriverStore.NetworkDriverInstance, default Unity.Networking.Transport.NetworkSettings and registering these on the NetworkDriverStore.

    Inheritance
    object
    DefaultDriverBuilder
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.NetCode
    Assembly: Unity.NetCode.dll
    Syntax
    public static class DefaultDriverBuilder

    Properties

    DefaultDriverConstructor

    Return an instance of the IPCAndSocketDriverConstructor constructor

    Declaration
    public static INetworkStreamDriverConstructor DefaultDriverConstructor { get; }
    Property Value
    Type Description
    INetworkStreamDriverConstructor

    Methods

    AddNetcodePackageNetworkConfigParameters(ref NetworkSettings, bool)

    Helper: Adds all netcode-package specific Global settings for the Unity.Networking.Transport.NetworkConfigParameter struct.

    Declaration
    public static void AddNetcodePackageNetworkConfigParameters(ref NetworkSettings settings, bool isServer)
    Parameters
    Type Name Description
    NetworkSettings settings

    The settings to inject into.

    bool isServer

    Settings differ for server worlds.

    ClientUseSocketDriver(NetDebug)

    Helper method to determine if the client world should prefer using a socket-based network interface (UDP or WebSocket) or the Unity.Networking.Transport.IPCNetworkInterface. IPC connection type is preferred only in case the RequestedPlayType is set to client/server mode, a server world exist in the process and the NetworkSimulatorSettings are disable (in the editor or development build).

    Declaration
    public static bool ClientUseSocketDriver(NetDebug netDebug)
    Parameters
    Type Name Description
    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    Returns
    Type Description
    bool

    True when a client world should use a network driver which implements a socket based interface.

    Remarks

    This method should not be used to configure server driver. Also, for server build, this method always return true.

    CreateClientNetworkDriver<T>(T)

    Helper method for creating NetworkDriver suitable for client. The driver will use the the specified netIf and is configured using the internal defaults. See: GetNetworkClientSettings().

    Declaration
    public static NetworkDriverStore.NetworkDriverInstance CreateClientNetworkDriver<T>(T netIf) where T : unmanaged, INetworkInterface
    Parameters
    Type Name Description
    T netIf

    the instance of a Unity.Networking.Transport.INetworkInterface to use to create the driver

    Returns
    Type Description
    NetworkDriverStore.NetworkDriverInstance

    A new NetworkDriverStore.NetworkDriverInstance

    Type Parameters
    Name Description
    T

    the Unity.Networking.Transport.INetworkInterface type ot use

    CreateClientNetworkDriver<T>(T, NetworkSettings)

    Helper method for creating NetworkDriver suitable for client. The driver will use the specified Unity.Networking.Transport.INetworkInterface and is configured using the provided settings.

    Declaration
    public static NetworkDriverStore.NetworkDriverInstance CreateClientNetworkDriver<T>(T netIf, NetworkSettings settings) where T : unmanaged, INetworkInterface
    Parameters
    Type Name Description
    T netIf

    the instance of a Unity.Networking.Transport.INetworkInterface to use to create the driver

    NetworkSettings settings

    A list of the parameters that describe the network configuration.

    Returns
    Type Description
    NetworkDriverStore.NetworkDriverInstance

    A new NetworkDriverStore.NetworkDriverInstance

    Type Parameters
    Name Description
    T

    the Unity.Networking.Transport.INetworkInterface type ot use

    CreateClientPipelines(ref NetworkDriverInstance)

    Create the default network pipelines (reliable, unreliable, unreliable fragmented) for the client.

    Declaration
    public static void CreateClientPipelines(ref NetworkDriverStore.NetworkDriverInstance driverInstance)
    Parameters
    Type Name Description
    NetworkDriverStore.NetworkDriverInstance driverInstance

    The NetworkDriverStore.NetworkDriverInstance instance to configure

    CreateClientSimulatorPipelines(ref NetworkDriverInstance)

    Should be used only for configuring client drivers, create the network pipelines (reliable, unreliable, unreliable fragmented) with network simulator support.

    Declaration
    public static void CreateClientSimulatorPipelines(ref NetworkDriverStore.NetworkDriverInstance driverInstance)
    Parameters
    Type Name Description
    NetworkDriverStore.NetworkDriverInstance driverInstance

    CreateServerNetworkDriver<T>(T)

    Helper method for creating server NetworkDriver given the specified netIf. The driver is configured with the internal defaults. See: GetNetworkServerSettings(int).

    Declaration
    public static NetworkDriverStore.NetworkDriverInstance CreateServerNetworkDriver<T>(T netIf) where T : unmanaged, INetworkInterface
    Parameters
    Type Name Description
    T netIf

    the instance of a Unity.Networking.Transport.INetworkInterface to use to create the driver

    Returns
    Type Description
    NetworkDriverStore.NetworkDriverInstance

    A new NetworkDriverStore.NetworkDriverInstance

    Type Parameters
    Name Description
    T

    the Unity.Networking.Transport.INetworkInterface type ot use

    CreateServerNetworkDriver<T>(T, int)

    Helper method for creating server NetworkDriver given the specified netIf. The driver is configured with the internal defaults. See: GetNetworkServerSettings(int).

    Declaration
    public static NetworkDriverStore.NetworkDriverInstance CreateServerNetworkDriver<T>(T netIf, int playerCount = 0) where T : unmanaged, INetworkInterface
    Parameters
    Type Name Description
    T netIf

    the instance of a Unity.Networking.Transport.INetworkInterface to use to create the driver

    int playerCount
    Returns
    Type Description
    NetworkDriverStore.NetworkDriverInstance

    A new NetworkDriverStore.NetworkDriverInstance

    Type Parameters
    Name Description
    T

    the Unity.Networking.Transport.INetworkInterface type ot use

    CreateServerNetworkDriver<T>(T, NetworkSettings)

    Helper method for creating server NetworkDriver given the specified netIf The driver is configured using the settings

    Declaration
    public static NetworkDriverStore.NetworkDriverInstance CreateServerNetworkDriver<T>(T netIf, NetworkSettings settings) where T : unmanaged, INetworkInterface
    Parameters
    Type Name Description
    T netIf

    the instance of a Unity.Networking.Transport.INetworkInterface to use to create the driver

    NetworkSettings settings

    A list of the parameters that describe the network configuration.

    Returns
    Type Description
    NetworkDriverStore.NetworkDriverInstance

    A new NetworkDriverStore.NetworkDriverInstance

    Type Parameters
    Name Description
    T

    The Unity.Networking.Transport.INetworkInterface type to use

    CreateServerPipelines(ref NetworkDriverInstance)

    Create the default network pipelines (reliable, unreliable, unreliable fragmented) for the server.

    Declaration
    public static void CreateServerPipelines(ref NetworkDriverStore.NetworkDriverInstance driverInstance)
    Parameters
    Type Name Description
    NetworkDriverStore.NetworkDriverInstance driverInstance

    The NetworkDriverStore.NetworkDriverInstance instance to configure

    GetNetworkClientSettings()

    Return a set of default settings for the client world. This will use the NetworkSimulator parameters set by PlayMode Tools.

    Declaration
    public static NetworkSettings GetNetworkClientSettings()
    Returns
    Type Description
    NetworkSettings

    A new Unity.Networking.Transport.NetworkSettings instance.

    GetNetworkServerSettings()

    Return a set of internal default settings. This will use the NetworkSimulator parameters set by PlayMode Tools.

    Declaration
    public static NetworkSettings GetNetworkServerSettings()
    Returns
    Type Description
    NetworkSettings

    Parameters that describe the network configuration.

    GetNetworkServerSettings(int)

    Return a set of internal default settings. This will use the NetworkSimulator parameters set by PlayMode Tools.

    Declaration
    public static NetworkSettings GetNetworkServerSettings(int playerCount = 0)
    Parameters
    Type Name Description
    int playerCount
    Returns
    Type Description
    NetworkSettings

    Parameters that describe the network configuration.

    GetNetworkSettings()

    Return a set of default settings for the client world. This will use the NetworkSimulator parameters set by PlayMode Tools.

    Declaration
    public static NetworkSettings GetNetworkSettings()
    Returns
    Type Description
    NetworkSettings

    A new Unity.Networking.Transport.NetworkSettings instance.

    RegisterClientDriver(World, ref NetworkDriverStore, NetDebug)

    Register a NetworkDriver instance in the driverStore that uses either:

    • a single IPCNetworkInterface NetworkDriver if both the client and server worlds are present in the same process.
    • a single UDPNetworkInterface driver if you are targeting a standalone platform.
    • a single WebSocketNetworkInterface if you are targeting WebGL.
    These are configured using internal defaults. See: GetNetworkClientSettings().
    Declaration
    public static void RegisterClientDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    RegisterClientDriver(World, ref NetworkDriverStore, NetDebug, ref FixedString4096Bytes, ref FixedString512Bytes)

    Register a NetworkDriver instance in and stores it in driverStore:
    - a single Unity.Networking.Transport.IPCNetworkInterface NetworkDriver if the both client and server worlds are present in the same process.
    - a single Unity.Networking.Transport.UDPNetworkInterface driver in all other cases.
    These are configured using the default settings. See GetNetworkClientSettings().

    Declaration
    public static void RegisterClientDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, ref FixedString4096Bytes caCertificate, ref FixedString512Bytes serverName)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    FixedString4096Bytes caCertificate

    Signed server certificate.

    FixedString512Bytes serverName

    Common name in the server certificate.

    RegisterClientDriver(World, ref NetworkDriverStore, NetDebug, NetworkSettings)

    Register a NetworkDriver instance in the driverStore that uses either:

    • a single IPCNetworkInterface NetworkDriver if both the client and server worlds are present in the same process.
    • a single UDPNetworkInterface driver if you are targeting a standalone platform.
    • a single WebSocketNetworkInterface if you are targeting WebGL.
    These are configured using the settings passed in.
    Declaration
    public static void RegisterClientDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, NetworkSettings settings)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    NetworkSettings settings

    A list of the parameters that describe the network configuration.

    RegisterClientDriver(World, ref NetworkDriverStore, NetDebug, ref RelayServerData)

    Register a NetworkDriver instance in and stores it in driverStore:
    - a single Unity.Networking.Transport.IPCNetworkInterface NetworkDriver if the both client and server worlds are present in the same process.
    - a single Unity.Networking.Transport.UDPNetworkInterface driver in all other cases.
    These are configured using the default settings. See GetNetworkClientSettings().

    Declaration
    public static void RegisterClientDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, ref RelayServerData relayData)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    RelayServerData relayData

    Server information to make a connection using a relay server.

    RegisterClientIpcDriver(World, ref NetworkDriverStore, NetDebug, NetworkSettings)

    Register an Unity.Networking.Transport.IPCNetworkInterface NetworkDriver instance in driverStore. This are configured using the settings passed in.

    Declaration
    public static void RegisterClientIpcDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, NetworkSettings settings)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    NetworkSettings settings

    A list of the parameters that describe the network configuration.

    RegisterClientUdpDriver(World, ref NetworkDriverStore, NetDebug, NetworkSettings)

    Register a Unity.Networking.Transport.UDPNetworkInterface NetworkDriver instance in driverStore. This are configured using the settings passed in.

    Declaration
    public static void RegisterClientUdpDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, NetworkSettings settings)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    NetworkSettings settings

    A list of the parameters that describe the network configuration.

    RegisterClientWebSocketDriver(World, ref NetworkDriverStore, NetDebug, NetworkSettings)

    Register a Unity.Networking.Transport.WebSocketNetworkInterface NetworkDriver instance in driverStore. This are configured using the settings passed in. The constructed driver does not use a reliable pipeline stage (websocket are already reliable) and the reliablePipeline instance is a Unity.Networking.Transport.NullPipelineStage.

    Declaration
    public static void RegisterClientWebSocketDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, NetworkSettings settings)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    NetworkSettings settings

    A list of the parameters that describe the network configuration.

    RegisterServerDriver(World, ref NetworkDriverStore, NetDebug)

    Register multiple NetworkDriver instances to the driverStore that uses different Unity.Networking.Transport.INetworkInterface:

    • One driver that uses `IPCNetworkInterface` if the `ClientServerBootstrap.RequestedPlayType` is Client/Server.
    • One driver that uses `UDPNetworkInterface` if the current build target is a standalone platorm (no WebGL) or dedicated server.
    • One driver that uses `WebSocketNetworkInterface` if the current build target is WebGL.
    These are configured using internal defaults. See: GetNetworkClientSettings().
    Declaration
    public static void RegisterServerDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    RegisterServerDriver(World, ref NetworkDriverStore, NetDebug, int)

    Register multiple NetworkDriver instances to the driverStore that uses different Unity.Networking.Transport.INetworkInterface:

    • One driver that uses `IPCNetworkInterface` if the `ClientServerBootstrap.RequestedPlayType` is Client/Server.
    • One driver that uses `UDPNetworkInterface` if the current build target is a standalone platorm (no WebGL) or dedicated server.
    • One driver that uses `WebSocketNetworkInterface` if the current build target is WebGL.
    These are configured using internal defaults. See: GetNetworkClientSettings().
    Declaration
    public static void RegisterServerDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, int playerCount = 0)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    int playerCount

    RegisterServerDriver(World, ref NetworkDriverStore, NetDebug, ref FixedString4096Bytes, ref FixedString4096Bytes)

    Register a multiple NetworkDriver instances to hte driverStore:

    • One driver that uses IPCNetworkInterface if the ClientServerBootstrap.RequestedPlayType is Client/Server.
    • For all targets apart WebGL, one driver instance using a UDPNetworkInterface. For WebGL and in the Editor, one driver instance using the WebSocketNetworkInterface.
    These are configured using the default settings. See GetNetworkServerSettings(int).
    Declaration
    public static void RegisterServerDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, ref FixedString4096Bytes certificate, ref FixedString4096Bytes privateKey)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    FixedString4096Bytes certificate
    FixedString4096Bytes privateKey
    Remarks

    Not available for WebGL builds. Always available in the Editor.

    RegisterServerDriver(World, ref NetworkDriverStore, NetDebug, ref FixedString4096Bytes, ref FixedString4096Bytes, int)

    Register a multiple NetworkDriver instances to hte driverStore:

    • One driver that uses IPCNetworkInterface if the ClientServerBootstrap.RequestedPlayType is Client/Server.
    • For all targets apart WebGL, one driver instance using a UDPNetworkInterface. For WebGL and in the Editor, one driver instance using the WebSocketNetworkInterface.
    These are configured using the default settings. See GetNetworkServerSettings(int).
    Declaration
    public static void RegisterServerDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, ref FixedString4096Bytes certificate, ref FixedString4096Bytes privateKey, int playerCount = 0)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    FixedString4096Bytes certificate
    FixedString4096Bytes privateKey
    int playerCount
    Remarks

    Not available for WebGL builds. Always available in the Editor.

    RegisterServerDriver(World, ref NetworkDriverStore, NetDebug, NetworkSettings)

    Register a multiple NetworkDriver instances to hte driverStore:

    • One driver that uses `IPCNetworkInterface` if the `ClientServerBootstrap.RequestedPlayType` is Client/Server.
    • One driver that uses `UDPNetworkInterface` if the current build target is a standalone platorm (no WebGL) or dedicated server.
    • One driver that uses `WebSocketNetworkInterface` if the current build target is WebGL.
    These drivers are configured using the settings passed in.
    Declaration
    public static void RegisterServerDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, NetworkSettings settings)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    NetworkSettings settings

    A list of the parameters that describe the network configuration.

    Remarks

    Not available for WebGL builds. Always available in the Editor.

    RegisterServerDriver(World, ref NetworkDriverStore, NetDebug, ref RelayServerData)

    Register multiple NetworkDriver instances to the driverStore that uses different Unity.Networking.Transport.INetworkInterface:

    • One driver that uses IPCNetworkInterface if the ClientServerBootstrap.RequestedPlayType is Client/Server.
    • One driver that uses UDPNetworkInterface if the current build target is a standalone platorm (no WebGL) or dedicated server.
    • One driver that uses WebSocketNetworkInterface if the current build target is WebGL.
    These are configured using internal defaults. See: GetNetworkClientSettings().
    Declaration
    public static void RegisterServerDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, ref RelayServerData relayData)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    RelayServerData relayData

    Server information to make a connection using a relay server.

    Remarks

    Not available for WebGL builds. Always available in the Editor.

    RegisterServerDriver(World, ref NetworkDriverStore, NetDebug, ref RelayServerData, int)

    Register multiple NetworkDriver instances to the driverStore that uses different Unity.Networking.Transport.INetworkInterface:

    • One driver that uses IPCNetworkInterface if the ClientServerBootstrap.RequestedPlayType is Client/Server.
    • One driver that uses UDPNetworkInterface if the current build target is a standalone platorm (no WebGL) or dedicated server.
    • One driver that uses WebSocketNetworkInterface if the current build target is WebGL.
    These are configured using internal defaults. See: GetNetworkClientSettings().
    Declaration
    public static void RegisterServerDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, ref RelayServerData relayData, int playerCount = 0)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    RelayServerData relayData

    Server information to make a connection using a relay server.

    int playerCount
    Remarks

    Not available for WebGL builds. Always available in the Editor.

    RegisterServerIpcDriver(World, ref NetworkDriverStore, NetDebug, NetworkSettings)

    Register a Unity.Networking.Transport.IPCNetworkInterface NetworkDriver instance in driverStore. This are configured using the settings passed in.

    Declaration
    public static void RegisterServerIpcDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, NetworkSettings settings)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    NetworkSettings settings

    A list of the parameters that describe the network configuration.

    Remarks

    Not available for WebGL builds. Always available in the Editor.

    RegisterServerUdpDriver(World, ref NetworkDriverStore, NetDebug, NetworkSettings)

    Register a Unity.Networking.Transport.UDPNetworkInterface NetworkDriver instance in driverStore. These are configured using the settings passed in.

    Declaration
    public static void RegisterServerUdpDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, NetworkSettings settings)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    NetworkSettings settings

    A list of the parameters that describe the network configuration.

    Remarks

    Not available for WebGL builds. Always available in the Editor.

    RegisterServerWebSocketDriver(World, ref NetworkDriverStore, NetDebug, NetworkSettings)

    Register a Unity.Networking.Transport.WebSocketNetworkInterface NetworkDriver instance in driverStore. This are configured using the settings passed in. The constructed driver does not use a reliable pipeline stage (websocket are already reliable) and the reliablePipeline instance is a Unity.Networking.Transport.NullPipelineStage.

    Declaration
    public static void RegisterServerWebSocketDriver(World world, ref NetworkDriverStore driverStore, NetDebug netDebug, NetworkSettings settings)
    Parameters
    Type Name Description
    World world

    Used for determining whether we are running in a client or server world.

    NetworkDriverStore driverStore

    Store for NetworkDriver.

    NetDebug netDebug

    The netDebug singleton, for logging errors and debug information

    NetworkSettings settings

    A list of the parameters that describe the network configuration.

    Remarks

    Not available for WebGL build. Always available in the Editor.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)