Class NetworkConfig
The configuration object used to start server, client and hosts
Inherited Members
Namespace: Unity.Netcode
Assembly: solution.dll
Syntax
[Serializable]
public class NetworkConfig
Fields
Name | Description |
---|---|
ClientConnectionBufferTimeout | The 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. |
ConnectionApproval | Whether or not to use connection approval |
ConnectionData | The data to send during connection which can be used to decide on if a client should get accepted |
EnableNetworkLogs | Whether or not to enable network logs. |
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. |
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 |
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. |
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 |
LoadSceneTimeOut | The amount of seconds to wait for all clients to load or unload a requested scene |
NetworkIdRecycleDelay | The amount of seconds a NetworkId has to be unused in order for it to be reused. |
NetworkTransport | The transport hosts the sever uses |
PlayerPrefab | The default player prefab |
Prefabs | |
ProtocolVersion | The protocol version. Different versions doesn't talk to each other. |
RecycleNetworkIds | If true, NetworkIds will be reused after the NetworkIdRecycleDelay. |
RpcHashSize | Decides how many bytes to use for Rpc messaging. Leave this to 2 bytes unless you are facing hash collisions |
RttAverageSamples | The number of RTT samples that is kept as an average for calculations |
RttWindowSize | The number of slots used for RTT calculations. This is the maximum amount of in-flight messages |
SpawnTimeout | The 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. |
TickRate | The tickrate of network ticks. This value controls how often netcode runs user code and sends out data. |
TimeResyncInterval | If time re-sync is turned on, this specifies the interval between syncs in seconds. |
Methods
Name | Description |
---|---|
CompareConfig(ulong) | Compares a SHA256 hash with the current NetworkConfig instances hash |
FromBase64(string) | Sets the NetworkConfig data with that from a base64 encoded version |
GetConfig(bool) | Gets a SHA256 hash of parts of the NetworkConfig instance |
ToBase64() | Returns a base64 encoded version of the configuration |