Class NetworkConfig
The configuration object used to start server, client and hosts
#
InheritanceSystem.Object
NetworkConfig
#
Inherited MembersSystem.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
#
Namespace: Unity.Netcode#
Assembly: MLAPI.dll#
Syntax#
Fields#
ClientConnectionBufferTimeoutThe amount of seconds for the server to wait for the connection approval handshake to complete before the client is disconnected.
If the timeout is reached before approval is completed the client will be disconnected.
#
Declaration#
Field ValueType | Description |
---|---|
System.Int32 |
#
RemarksThe period begins after the Connect is received on the server. The period ends once the server finishes processing a Unity.Netcode.ConnectionRequestMessage from the client.
This setting is independent of any Transport-level timeouts that may be in effect. It covers the time between the connection being established on the Transport layer, the client sending a Unity.Netcode.ConnectionRequestMessage, and the server processing that message through ConnectionApproval.
This setting is server-side only.
#
ConnectionApprovalWhether or not to use connection approval
#
Declaration#
Field ValueType | Description |
---|---|
System.Boolean |
#
ConnectionDataThe data to send during connection which can be used to decide on if a client should get accepted
#
Declaration#
Field ValueType | Description |
---|---|
System.Byte[] |
#
EnableNetworkLogsWhether or not to enable network logs.
#
Declaration#
Field ValueType | Description |
---|---|
System.Boolean |
#
EnableSceneManagementEnables scene management. This will allow network scene switches and automatic scene difference corrections upon connect. SoftSynced scene objects wont work with this disabled. That means that disabling SceneManagement also enables PrefabSync.
#
Declaration#
Field ValueType | Description |
---|---|
System.Boolean |
#
EnableTimeResyncIf your logic uses the NetworkTime, this should probably be turned off. If however it's needed to maximize accuracy, this is recommended to be turned on
#
Declaration#
Field ValueType | Description |
---|---|
System.Boolean |
#
EnsureNetworkVariableLengthSafetyWhether or not to ensure that NetworkVariables can be read even if a client accidentally writes where its not allowed to. This costs some CPU and bandwidth.
#
Declaration#
Field ValueType | Description |
---|---|
System.Boolean |
#
ForceSamePrefabsWhether or not the netcode should check for differences in the prefabs at connection. If you dynamically add prefabs at runtime, turn this OFF
#
Declaration#
Field ValueType | Description |
---|---|
System.Boolean |
#
LoadSceneTimeOutThe amount of seconds to wait for all clients to load or unload a requested scene
#
Declaration#
Field ValueType | Description |
---|---|
System.Int32 |
#
NetworkIdRecycleDelayThe amount of seconds a NetworkId has to be unused in order for it to be reused.
#
Declaration#
Field ValueType | Description |
---|---|
System.Single |
#
NetworkTransportThe transport hosts the sever uses
#
Declaration#
Field ValueType | Description |
---|---|
NetworkTransport |
#
PlayerPrefabThe default player prefab
#
Declaration#
Field ValueType | Description |
---|---|
GameObject |
#
ProtocolVersionThe protocol version. Different versions doesn't talk to each other.
#
Declaration#
Field ValueType | Description |
---|---|
System.UInt16 |
#
RecycleNetworkIdsIf true, NetworkIds will be reused after the NetworkIdRecycleDelay.
#
Declaration#
Field ValueType | Description |
---|---|
System.Boolean |
#
RpcHashSizeDecides how many bytes to use for Rpc messaging. Leave this to 2 bytes unless you are facing hash collisions
#
Declaration#
Field ValueType | Description |
---|---|
HashSize |
#
RttAverageSamplesThe number of RTT samples that is kept as an average for calculations
#
Declaration#
Field ValueType | Description |
---|---|
System.Int32 |
#
RttWindowSizeThe number of slots used for RTT calculations. This is the maximum amount of in-flight messages
#
Declaration#
Field ValueType | Description |
---|---|
System.Int32 |
#
SpawnTimeoutThe amount of time a message should be buffered if the asset or object needed to process it doesn't exist yet. If the asset is not added/object is not spawned within this time, it will be dropped.
#
Declaration#
Field ValueType | Description |
---|---|
System.Single |
#
TickRateThe tickrate of network ticks. This value controls how often netcode runs user code and sends out data.
#
Declaration#
Field ValueType | Description |
---|---|
System.UInt32 |
#
TimeResyncIntervalIf time re-sync is turned on, this specifies the interval between syncs in seconds.
#
Declaration#
Field ValueType | Description |
---|---|
System.Int32 |
#
Methods#
CompareConfig(UInt64)Compares a SHA256 hash with the current NetworkConfig instances hash
#
Declaration#
ParametersType | Name | Description |
---|---|---|
System.UInt64 | hash |
#
ReturnsType | Description |
---|---|
System.Boolean |
#
FromBase64(String)Sets the NetworkConfig data with that from a base64 encoded version
#
Declaration#
ParametersType | Name | Description |
---|---|---|
System.String | base64 | The base64 encoded version |
#
GetConfig(Boolean)Gets a SHA256 hash of parts of the NetworkConfig instance
#
Declaration#
ParametersType | Name | Description |
---|---|---|
System.Boolean | cache |
#
ReturnsType | Description |
---|---|
System.UInt64 |
#
ToBase64()Returns a base64 encoded version of the configuration
#
Declaration#
ReturnsType | Description |
---|---|
System.String |