From 11bd4523b0a6005c7b83fede8c73d990994e0f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Cor=C3=A9n?= <2108U9@gmail.com> Date: Thu, 8 Mar 2018 18:16:51 +0100 Subject: [PATCH] Added LegacyChannel to config --- MLAPI/Data/NetworkingConfiguration.cs | 1 + MLAPI/MonoBehaviours/Core/NetworkingManager.cs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/MLAPI/Data/NetworkingConfiguration.cs b/MLAPI/Data/NetworkingConfiguration.cs index 9237738..2bc956c 100644 --- a/MLAPI/Data/NetworkingConfiguration.cs +++ b/MLAPI/Data/NetworkingConfiguration.cs @@ -32,6 +32,7 @@ namespace MLAPI public bool EncryptMessages = false; public bool AllowPassthroughMessages = true; public bool EnableSceneSwitching = false; + public bool UseLegacyChannel = false; //Cached config hash private byte[] ConfigHash = null; diff --git a/MLAPI/MonoBehaviours/Core/NetworkingManager.cs b/MLAPI/MonoBehaviours/Core/NetworkingManager.cs index df98db8..839594f 100644 --- a/MLAPI/MonoBehaviours/Core/NetworkingManager.cs +++ b/MLAPI/MonoBehaviours/Core/NetworkingManager.cs @@ -106,7 +106,13 @@ namespace MLAPI ConnectionConfig cConfig = new ConnectionConfig(); //MLAPI channels and messageTypes - NetworkConfig.Channels.Add("MLAPI_RELIABLE_FRAGMENTED_SEQUENCED", QosType.ReliableFragmentedSequenced); + + //Legacy channel. ReliableFragmentedSequenced doesn't exist in older Unity versions. + if(NetworkConfig.UseLegacyChannel) + NetworkConfig.Channels.Add("MLAPI_RELIABLE_FRAGMENTED_SEQUENCED", QosType.ReliableSequenced); + else + NetworkConfig.Channels.Add("MLAPI_RELIABLE_FRAGMENTED_SEQUENCED", QosType.ReliableFragmentedSequenced); + NetworkConfig.Channels.Add("MLAPI_POSITION_UPDATE", QosType.StateUpdate); NetworkConfig.Channels.Add("MLAPI_ANIMATION_UPDATE", QosType.ReliableSequenced); MessageManager.messageTypes.Add("MLAPI_CONNECTION_REQUEST", 0);