diff --git a/Assets/Scripts/GlobalBehaviour.cs b/Assets/Scripts/GlobalBehaviour.cs index 243cf100c74d5069bcf9ebe1dc068d0da69f5730..8fb3b5ca09c75779c68301fb2e782c2a2472c05b 100644 --- a/Assets/Scripts/GlobalBehaviour.cs +++ b/Assets/Scripts/GlobalBehaviour.cs @@ -277,4 +277,19 @@ IEnumerator _GetContextfromServer() yield break; } } + + /// <summary> + /// Make sure the local MMT server gets killed if the game closes. + /// </summary> + private void OnApplicationQuit() + { + StreamingAssetLoader.NetworkJSON_Save(); + if (CommunicationEvents.process_mmt_frameIT_server != null) + { + if (!CommunicationEvents.process_mmt_frameIT_server.HasExited) + { + CommunicationEvents.process_mmt_frameIT_server.Kill(); + } + } + } }