Skip to main content

Unity.Netcode.NetworkConfig

The configuration object used to start server, client and hosts

Inheritance#

System.Dynamic.ExpandoObject

System.Dynamic.ExpandoObject

Inherited Members#

Object.Equals(Object)

Object.Equals(Object, Object)

Object.GetHashCode()

Object.GetType()

Object.MemberwiseClone()

Object.ReferenceEquals(Object, Object)

Object.ToString()

Namespace: System.Dynamic.ExpandoObject#
Assembly: MLAPI.dll#
Syntax#
[Serializable]
public class NetworkConfig

ClientConnectionBufferTimeout#

The amount of seconds to wait for handshake to complete before timing out a client

Declaration#

public int ClientConnectionBufferTimeout

Field Value#

TypeDescription
System.Int32

ConnectionApproval#

Whether or not to use connection approval

Declaration#

public bool ConnectionApproval

Field Value#

TypeDescription
System.Boolean

ConnectionData#

The data to send during connection which can be used to decide on if a client should get accepted

Declaration#

public byte[] ConnectionData

Field Value#

TypeDescription
System.Byte[]

EnableNetworkLogs#

Whether or not to enable network logs.

Declaration#

public bool EnableNetworkLogs

Field Value#

TypeDescription
System.Boolean

EnableSceneManagement#

Enables 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#

public bool EnableSceneManagement

Field Value#

TypeDescription
System.Boolean

EnableTimeResync#

If 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#

public bool EnableTimeResync

Field Value#

TypeDescription
System.Boolean

EnsureNetworkVariableLengthSafety#

Whether 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#

public bool EnsureNetworkVariableLengthSafety

Field Value#

TypeDescription
System.Boolean

ForceSamePrefabs#

Whether or not the netcode should check for differences in the prefabs at connection. If you dynamically add prefabs at runtime, turn this OFF

Declaration#

public bool ForceSamePrefabs

Field Value#

TypeDescription
System.Boolean

LoadSceneTimeOut#

The amount of seconds to wait for all clients to load or unload a requested scene

Declaration#

public int LoadSceneTimeOut

Field Value#

TypeDescription
System.Int32

MessageBufferTimeout#

The amount of time a message should be buffered for without being consumed. If it is not consumed within this time, it will be dropped.

Declaration#

public float MessageBufferTimeout

Field Value#

TypeDescription
System.Single

NetworkIdRecycleDelay#

The amount of seconds a NetworkId has to be unused in order for it to be reused.

Declaration#

public float NetworkIdRecycleDelay

Field Value#

TypeDescription
System.Single

NetworkTransport#

The transport hosts the sever uses

Declaration#

public NetworkTransport NetworkTransport

Field Value#

TypeDescription
NetworkTransport

PlayerPrefab#

The default player prefab

Declaration#

public GameObject PlayerPrefab

Field Value#

TypeDescription
GameObject

ProtocolVersion#

The protocol version. Different versions doesn't talk to each other.

Declaration#

public ushort ProtocolVersion

Field Value#

TypeDescription
System.UInt16

RecycleNetworkIds#

If true, NetworkIds will be reused after the NetworkIdRecycleDelay.

Declaration#

public bool RecycleNetworkIds

Field Value#

TypeDescription
System.Boolean

RpcHashSize#

Decides how many bytes to use for Rpc messaging. Leave this to 2 bytes unless you are facing hash collisions

Declaration#

public HashSize RpcHashSize

Field Value#

TypeDescription
HashSize

RttAverageSamples#

Declaration#

public const int RttAverageSamples = 5

Field Value#

TypeDescription
System.Int32

RttWindowSize#

Declaration#

public const int RttWindowSize = 64

Field Value#

TypeDescription
System.Int32

TickRate#

The tickrate of network ticks. This value controls how often netcode runs user code and sends out data.

Declaration#

public uint TickRate

Field Value#

TypeDescription
System.UInt32

TimeResyncInterval#

If time re-sync is turned on, this specifies the interval between syncs in seconds.

Declaration#

public int TimeResyncInterval

Field Value#

TypeDescription
System.Int32

#

SnapshotMaxSpawnUsage#

When Snapshot System spawn is enabled: max size of Snapshot Messages. Meant to fit MTU.

Declaration#

public int SnapshotMaxSpawnUsage { get; }

Property Value#

TypeDescription
System.Int32

UseSnapshotDelta#

Whether or not to enable Snapshot System for variable updates. Not supported in this version.

Declaration#

public bool UseSnapshotDelta { get; }

Property Value#

TypeDescription
System.Boolean

UseSnapshotSpawn#

Whether or not to enable Snapshot System for spawn and despawn commands. Not supported in this version.

Declaration#

public bool UseSnapshotSpawn { get; }

Property Value#

TypeDescription
System.Boolean

#

CompareConfig(UInt64)#

Compares a SHA256 hash with the current NetworkConfig instances hash

Declaration#

public bool CompareConfig(ulong hash)

Parameters#

TypeNameDescription
System.UInt64hash

Returns#

TypeDescription
System.Boolean

FromBase64(String)#

Sets the NetworkConfig data with that from a base64 encoded version

Declaration#

public void FromBase64(string base64)

Parameters#

TypeNameDescription
System.Stringbase64The base64 encoded version

GetConfig(Boolean)#

Gets a SHA256 hash of parts of the NetworkConfig instance

Declaration#

public ulong GetConfig(bool cache = true)

Parameters#

TypeNameDescription
System.Booleancache

Returns#

TypeDescription
System.UInt64

ToBase64()#

Returns a base64 encoded version of the configuration

Declaration#

public string ToBase64()

Returns#

TypeDescription
System.String