From 6e99899de9a4eb21a5e3a585461068c742ebb2dd Mon Sep 17 00:00:00 2001 From: Fernando Cortez Date: Mon, 21 Aug 2023 13:19:59 -0400 Subject: [PATCH 1/3] unsubscription on application.wantstoquit to avoid infinite loop --- Assets/Scripts/ApplicationLifecycle/ApplicationController.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Assets/Scripts/ApplicationLifecycle/ApplicationController.cs b/Assets/Scripts/ApplicationLifecycle/ApplicationController.cs index b2ba6cd18..223dde606 100644 --- a/Assets/Scripts/ApplicationLifecycle/ApplicationController.cs +++ b/Assets/Scripts/ApplicationLifecycle/ApplicationController.cs @@ -122,6 +122,8 @@ private IEnumerator LeaveBeforeQuit() private bool OnWantToQuit() { + Application.wantsToQuit -= OnWantToQuit; + var canQuit = string.IsNullOrEmpty(m_LocalLobby?.LobbyID); if (!canQuit) { From eea5b018d189ec44b437be443c08c1ed9484f973 Mon Sep 17 00:00:00 2001 From: Fernando Cortez Date: Mon, 21 Aug 2023 13:57:02 -0400 Subject: [PATCH 2/3] changelog addition --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 469ee6c4a..1c4725f16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Additional documentation and release notes are available at [Multiplayer Documen ### Fixed * Fixed colliders on diagonal walls to not have negative scale (#854). +* Fixed a condition where one would be unable to quit the application through OS-level quit button, nor the in-game quit button (#863) ## [2.2.0] - 2023-07-06 From 6fdd917038befb3c40d5a1dad5f3c7c5fa215908 Mon Sep 17 00:00:00 2001 From: Fernando Cortez Date: Thu, 31 Aug 2023 11:26:43 -0400 Subject: [PATCH 3/3] code formatting --- .../ApplicationLifecycle/ApplicationController.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/ApplicationLifecycle/ApplicationController.cs b/Assets/Scripts/ApplicationLifecycle/ApplicationController.cs index 223dde606..874864a40 100644 --- a/Assets/Scripts/ApplicationLifecycle/ApplicationController.cs +++ b/Assets/Scripts/ApplicationLifecycle/ApplicationController.cs @@ -17,15 +17,17 @@ namespace Unity.BossRoom.ApplicationLifecycle { - /// /// An entry point to the application, where we bind all the common dependencies to the root DI scope. /// public class ApplicationController : LifetimeScope { - [SerializeField] UpdateRunner m_UpdateRunner; - [SerializeField] ConnectionManager m_ConnectionManager; - [SerializeField] NetworkManager m_NetworkManager; + [SerializeField] + UpdateRunner m_UpdateRunner; + [SerializeField] + ConnectionManager m_ConnectionManager; + [SerializeField] + NetworkManager m_NetworkManager; LocalLobby m_LocalLobby; LobbyServiceFacade m_LobbyServiceFacade; @@ -116,6 +118,7 @@ private IEnumerator LeaveBeforeQuit() { Debug.LogError(e.Message); } + yield return null; Application.Quit(); } @@ -123,12 +126,13 @@ private IEnumerator LeaveBeforeQuit() private bool OnWantToQuit() { Application.wantsToQuit -= OnWantToQuit; - + var canQuit = string.IsNullOrEmpty(m_LocalLobby?.LobbyID); if (!canQuit) { StartCoroutine(LeaveBeforeQuit()); } + return canQuit; }