Class DefaultDriverBuilder
Default helper method implementation for constructing Network
Inherited Members
Namespace: Unity.NetCode
Assembly: Unity.NetCode.dll
Syntax
public static class DefaultDriverBuilder
Properties
DefaultDriverConstructor
Return an instance of the IPCAnd
Declaration
public static INetworkStreamDriverConstructor DefaultDriverConstructor { get; }
Property Value
Type | Description |
---|---|
INetwork |
Methods
ClientUseSocketDriver(NetDebug)
Helper method to determine if the client world should prefer using a socket-based network interface
(UDP or WebSocket) or the Unity.
Declaration
public static bool ClientUseSocketDriver(NetDebug netDebug)
Parameters
Type | Name | Description |
---|---|---|
Net |
netDebug |
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: Get
Declaration
public static NetworkDriverStore.NetworkDriverInstance CreateClientNetworkDriver<T>(T netIf) where T : unmanaged, INetworkInterface
Parameters
Type | Name | Description |
---|---|---|
T | netIf | the instance of a Unity. |
Returns
Type | Description |
---|---|
Network |
Type Parameters
Name | Description |
---|---|
T | the Unity. |
CreateClientNetworkDriver<T>(T, NetworkSettings)
Helper method for creating NetworkDriver suitable for client.
The driver will use the specified Unity.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. |
Network |
settings | A list of the parameters that describe the network configuration. |
Returns
Type | Description |
---|---|
Network |
Type Parameters
Name | Description |
---|---|
T | the Unity. |
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 |
---|---|---|
Network |
driverInstance | The Network |
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 |
---|---|---|
Network |
driverInstance |
CreateServerNetworkDriver<T>(T, int)
Helper method for creating server NetworkDriver given the specified netIf
.
The driver is configured with the internal defaults. See: Get
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. |
int | playerCount | Amount of players the server should allocate receive and send queue for. The estimation is that each player will receive 4 packets. |
Returns
Type | Description |
---|---|
Network |
Type Parameters
Name | Description |
---|---|
T | the Unity. |
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 | |
Network |
settings | A list of the parameters that describe the network configuration. |
Returns
Type | Description |
---|---|
Network |
Type Parameters
Name | Description |
---|---|
T | The Unity. |
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 |
---|---|---|
Network |
driverInstance | The Network |
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 | Amount of players the server should allocate receive and send queue for. The estimation is that each player will receive 4 packets. |
Returns
Type | Description |
---|---|
Network |
Parameters that describe the network configuration. |
GetNetworkSettings()
Return a set of internal default settings. This will use the NetworkSimulator parameters set by PlayMode Tools.
Declaration
public static NetworkSettings GetNetworkSettings()
Returns
Type | Description |
---|---|
Network |
RegisterClientDriver(World, ref NetworkDriverStore, NetDebug)
Register a NetworkDriver instance in the driverStore
that uses either:
- a single Unity.
Networking. NetworkDriver if both the client and server worlds are present in the same process.Transport. IPCNetwork Interface - a single Unity.
Networking. driver if you are targeting a standalone platform.Transport. UDPNetwork Interface - a single Unity.
Networking. if you are targeting WebGL.Transport. Web Socket Network Interface
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. |
Network |
driverStore | Store for NetworkDriver. |
Net |
netDebug | For handling logging. |
RegisterClientDriver(World, ref NetworkDriverStore, NetDebug, ref FixedString4096Bytes, ref FixedString512Bytes)
Register a NetworkDriver instance in and stores it in driverStore
:
- a single Unity.
- a single Unity.
These are configured using the default settings. See Get
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. |
Network |
driverStore | Store for NetworkDriver. |
Net |
netDebug | For handling logging. |
Fixed |
caCertificate | Signed server certificate. |
Fixed |
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 Unity.
Networking. NetworkDriver if both the client and server worlds are present in the same process.Transport. IPCNetwork Interface - a single Unity.
Networking. driver if you are targeting a standalone platform.Transport. UDPNetwork Interface - a single Unity.
Networking. if you are targeting WebGL.Transport. Web Socket Network Interface
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. |
Network |
driverStore | Store for NetworkDriver. |
Net |
netDebug | For handling logging. |
Network |
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.
- a single Unity.
These are configured using the default settings. See Get
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. |
Network |
driverStore | Store for NetworkDriver. |
Net |
netDebug | For handling logging. |
Relay |
relayData | Server information to make a connection using a relay server. |
RegisterClientIpcDriver(World, ref NetworkDriverStore, NetDebug, NetworkSettings)
Register an Unity.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. |
Network |
driverStore | Store for NetworkDriver. |
Net |
netDebug | For handling logging. |
Network |
settings | A list of the parameters that describe the network configuration. |
RegisterClientUdpDriver(World, ref NetworkDriverStore, NetDebug, NetworkSettings)
Register a Unity.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. |
Network |
driverStore | Store for NetworkDriver. |
Net |
netDebug | For handling logging. |
Network |
settings | A list of the parameters that describe the network configuration. |
RegisterClientWebSocketDriver(World, ref NetworkDriverStore, NetDebug, NetworkSettings)
Register a Unity.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 reliable
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. |
Network |
driverStore | Store for NetworkDriver. |
Net |
netDebug | For handling logging. |
Network |
settings | A list of the parameters that describe the network configuration. |
RegisterServerDriver(World, ref NetworkDriverStore, NetDebug, int)
Register multiple NetworkDriver instances to the driverStore
that uses different Unity.
- One driver that uses Unity.
Networking. if the `ClientServerBootstrap.RequestedPlayType` is Client/Server.Transport. IPCNetwork Interface - One driver that uses Unity.
Networking. if the current build target is a standalone platorm (no WebGL) or dedicated server.Transport. UDPNetwork Interface - One driver that uses Unity.
Networking. if the current build target is WebGL.Transport. Web Socket Network Interface
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. |
Network |
driverStore | Store for NetworkDriver. |
Net |
netDebug | For handling logging. |
int | playerCount | Amount of players the server should allocate receive and send queue for. The estimation is that each player will receive 4 packets. |
RegisterServerDriver(World, ref NetworkDriverStore, NetDebug, ref FixedString4096Bytes, ref FixedString4096Bytes, int)
Register a multiple NetworkDriver instances to hte driverStore
:
- One driver that uses Unity.
Networking. if the RequestedTransport. IPCNetwork Interface Play is Client/Server.Type - For all targets apart WebGL, one driver instance using a Unity.
Networking. . For WebGL and in the Editor, one driver instance using the Unity.Transport. UDPNetwork Interface Networking. .Transport. Web Socket Network Interface
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. |
Network |
driverStore | Store for NetworkDriver. |
Net |
netDebug | For handling logging. |
Fixed |
certificate | |
Fixed |
privateKey | |
int | playerCount | Amount of players the server should allocate receive and send queue for. The estimation is that each player will receive 4 packets. |
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 Unity.
Networking. if the `ClientServerBootstrap.RequestedPlayType` is Client/Server.Transport. IPCNetwork Interface - One driver that uses Unity.
Networking. if the current build target is a standalone platorm (no WebGL) or dedicated server.Transport. UDPNetwork Interface - One driver that uses Unity.
Networking. if the current build target is WebGL.Transport. Web Socket Network Interface
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. |
Network |
driverStore | Store for NetworkDriver. |
Net |
netDebug | For handling logging. |
Network |
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, int)
Register multiple NetworkDriver instances to the driverStore
that uses different Unity.
- One driver that uses Unity.
Networking. if the RequestedTransport. IPCNetwork Interface Play is Client/Server.Type - One driver that uses Unity.
Networking. if the current build target is a standalone platorm (no WebGL) or dedicated server.Transport. UDPNetwork Interface - One driver that uses Unity.
Networking. if the current build target is WebGL.Transport. Web Socket Network Interface
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. |
Network |
driverStore | Store for NetworkDriver. |
Net |
netDebug | For handling logging. |
Relay |
relayData | Server information to make a connection using a relay server. |
int | playerCount | Amount of players the server should allocate receive and send queue for. The estimation is that each player will receive 4 packets. |
Remarks
Not available for WebGL builds. Always available in the Editor.
RegisterServerIpcDriver(World, ref NetworkDriverStore, NetDebug, NetworkSettings)
Register a Unity.driverStore
.
This are configured using the settings
passed in.
If the requested Client
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. |
Network |
driverStore | Store for NetworkDriver. |
Net |
netDebug | For handling logging. |
Network |
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.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. |
Network |
driverStore | Store for NetworkDriver. |
Net |
netDebug | For handling logging. |
Network |
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.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 reliable
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. |
Network |
driverStore | Store for NetworkDriver. |
Net |
netDebug | For handling logging. |
Network |
settings | A list of the parameters that describe the network configuration. |
Remarks
Not available for WebGL build. Always available in the Editor.