From 2c31c78602781aa033e51f41a2fed30c268d22cc Mon Sep 17 00:00:00 2001 From: vis2k Date: Fri, 8 Jun 2018 10:48:29 +0200 Subject: [PATCH] NetworkManager.OnValidate: checks if channel[0] is Reliable and channel[1] is Unreliable because Channels.DefaultReliable is 0 and Unreliable is 1. The code assumes those channels to be there. --- .../Runtime/NetworkManager.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Unity-Technologies-networking/Runtime/NetworkManager.cs b/Unity-Technologies-networking/Runtime/NetworkManager.cs index e6d58a80e..3ca08cb74 100644 --- a/Unity-Technologies-networking/Runtime/NetworkManager.cs +++ b/Unity-Technologies-networking/Runtime/NetworkManager.cs @@ -256,6 +256,20 @@ void OnValidate() m_GlobalConfig.ThreadAwakeTimeout = 1; } } + + // vis2k + // Channels.DefaultReliable = 0 and Unreliable = 1, so we have to + // force some kind of reliable to channel 0 and unreliable to 1. + // Otherwise the HLAPI code will assume a wrong channel for a lot of + // built-in functions. + // + // Changing them would result in chaos. Using anything != Fragmented + // would fail to send bigger messages too. + if (channels.Count < 1 || !NetworkConnection.IsReliableQoS(channels[0])) + Debug.LogWarning("NetworkManager: First channel needs to be Reliable because in the code Channels.DefaultReliable is 0."); + + if (channels.Count < 2 || !NetworkConnection.IsUnreliableQoS(channels[1])) + Debug.LogWarning("NetworkManager: Second channel needs to be Unreliable because in the code Channels.DefaultReliable is 1."); } internal void RegisterServerMessages()