Skip to main content

MLAPI.Configuration.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

Fields#

AllowRuntimeSceneChanges#

Whether or not runtime scene changes should be allowed and expected. If this is true, clients with different initial configurations will not work together.

Declaration#

[Tooltip("Whether or not runtime scene changes should be allowed and expected.\n If this is true, clients with different initial configurations will not work together.")]
public bool AllowRuntimeSceneChanges

Field Value#

TypeDescription
System.Boolean

ClientConnectionBufferTimeout#

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

Declaration#

[Tooltip("The amount of seconds to wait for the handshake to complete before the client times out")]
public int ClientConnectionBufferTimeout

Field Value#

TypeDescription
System.Int32

ConnectionApproval#

Whether or not to use connection approval

Declaration#

[Tooltip("Whether or not to force clients to be approved before they connect")]
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#

[Tooltip("The connection data sent along with connection requests")]
public byte[] ConnectionData

Field Value#

TypeDescription
System.Byte[]

CreatePlayerPrefab#

Whether or not a player object should be created by default. This value can be overriden on a case by case basis with ConnectionApproval.

Declaration#

[Tooltip("Whether or not a player object should be created by default. This value can be overriden on a case by case basis with ConnectionApproval.")]
public bool CreatePlayerPrefab

Field Value#

TypeDescription
System.Boolean

EnableMessageBuffering#

Whether or not message buffering should be enabled. This will resolve most out of order messages during spawn.

Declaration#

[Tooltip("Whether or not message buffering should be enabled. This will resolve most out of order messages during spawn")]
public bool EnableMessageBuffering

Field Value#

TypeDescription
System.Boolean

EnableNetworkLogs#

Whether or not to enable network logs.

Declaration#

public bool EnableNetworkLogs

Field Value#

TypeDescription
System.Boolean

EnableNetworkVariable#

Whether or not to enable the NetworkVariable system. This system runs in the Update loop and will degrade performance, but it can be a huge convenience. Only turn it off if you have no need for the NetworkVariable system.

Declaration#

[Tooltip("Whether or not to enable the NetworkVariable system")]
public bool EnableNetworkVariable

Field Value#

TypeDescription
System.Boolean

EnableSceneManagement#

Enables scene management. This will allow network scene switches and automatic scene diff corrections upon connect. SoftSynced scene objects wont work with this disabled. That means that disabling SceneManagement also enables PrefabSync.

Declaration#

[Tooltip("Enables scene management. This will allow network scene switches and automatic scene diff corrections upon connect.\nSoftSynced scene objects wont work with this disabled. That means that disabling SceneManagement also enables PrefabSync.")]
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#

[Tooltip("Enable this to resync the NetworkTime after the initial sync")]
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 bandwdith.

Declaration#

[Tooltip("Ensures that NetworkVariables can be read even if a client accidental writes where its not allowed to. This will cost some CPU time and bandwidth")]
public bool EnsureNetworkVariableLengthSafety

Field Value#

TypeDescription
System.Boolean

EventTickrate#

The amount of times per second internal frame events will occur, e.g. send checking.

Declaration#

[Tooltip("The amount of times per second the internal event loop will run. This includes for example NetworkVariable checking.")]
public int EventTickrate

Field Value#

TypeDescription
System.Int32

ForceSamePrefabs#

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

Declaration#

[Tooltip("Whether or not the MLAPI should check for differences in the prefab lists at connection")]
public bool ForceSamePrefabs

Field Value#

TypeDescription
System.Boolean

LoadSceneTimeOut#

The amount of seconds to wait on all clients to load requested scene before the SwitchSceneProgress onComplete callback, that waits for all clients to complete loading, is called anyway.

Declaration#

[Tooltip("The amount of seconds to wait for all clients to load a requested scene")]
public int LoadSceneTimeOut

Field Value#

TypeDescription
System.Int32

MaxReceiveEventsPerTickRate#

The max amount of messages to process per ReceiveTickrate. This is to prevent flooding.

Declaration#

[Tooltip("The maximum amount of Receive events to poll per Receive tick. This is to prevent flooding and freezing on the server")]
public int MaxReceiveEventsPerTickRate

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#

[Tooltip("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")]
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#

[Tooltip("The amount of seconds a NetworkId has to unused in order for it to be reused")]
public float NetworkIdRecycleDelay

Field Value#

TypeDescription
System.Single

NetworkPrefabs#

A list of spawnable prefabs

Declaration#

[Tooltip("The prefabs that can be spawned across the network")]
[FormerlySerializedAs("NetworkedPrefabs")]
public List<NetworkPrefab> NetworkPrefabs

Field Value#

TypeDescription
System.Collections.Generic.List<NetworkPrefab>

NetworkTickIntervalSec#

Duration in seconds between network ticks.

Declaration#

[Tooltip("Duration in seconds between network ticks")]
public float NetworkTickIntervalSec

Field Value#

TypeDescription
System.Single

NetworkTransport#

The transport hosts the sever uses

Declaration#

[Tooltip("The NetworkTransport to use")]
public NetworkTransport NetworkTransport

Field Value#

TypeDescription
NetworkTransport

ProtocolVersion#

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

Declaration#

[Tooltip("Use this to make two builds incompatible with each other")]
public ushort ProtocolVersion

Field Value#

TypeDescription
System.UInt16

ReceiveTickrate#

Amount of times per second the receive queue is emptied and all messages inside are processed.

Declaration#

[Tooltip("The amount of times per second the receive queue is emptied from pending incoming messages")]
public int ReceiveTickrate

Field Value#

TypeDescription
System.Int32

RecycleNetworkIds#

If true, NetworkIds will be reused after the NetworkIdRecycleDelay.

Declaration#

[Tooltip("If true, NetworkIds will be reused after the NetworkIdRecycleDelay")]
public bool RecycleNetworkIds

Field Value#

TypeDescription
System.Boolean

RegisteredScenes#

A list of SceneNames that can be used during networked games.

Declaration#

[Tooltip("The Scenes that can be switched to by the server")]
public List<string> RegisteredScenes

Field Value#

TypeDescription
System.Collections.Generic.List<System.String>

RpcHashSize#

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

Declaration#

[Tooltip("The maximum amount of bytes to use for RPC messages. Leave this to 2 unless you are facing hash collisions")]
public HashSize RpcHashSize

Field Value#

TypeDescription
HashSize

TimeResyncInterval#

If time resync is turned on, this specifies the interval between syncs in seconds.

Declaration#

[Tooltip("The amount of seconds between resyncs of NetworkTime, if enabled")]
public int TimeResyncInterval

Field Value#

TypeDescription
System.Int32

UsePrefabSync#

If true, all NetworkObjects need to be prefabs and all scene objects will be replaced on server side which causes all serialization to be lost. Useful for multi project setups If false, Only non scene objects have to be prefabs. Scene objects will be matched using their PrefabInstanceId which can be precomputed globally for a scene at build time. Useful for single projects

Declaration#

[Tooltip("If true, all NetworkObjects need to be prefabs and all scene objects will be replaced on server side which causes all serialization to be lost. Useful for multi project setups\nIf false, Only non scene objects have to be prefabs. Scene objects will be matched using their PrefabInstanceId which can be precomputed globally for a scene at build time. Useful for single projects")]
public bool UsePrefabSync

Field Value#

TypeDescription
System.Boolean

Methods#

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 config

Declaration#

public string ToBase64()

Returns#

TypeDescription
System.String