Skip to content

Commit 910d6c2

Browse files
fix: unable to quit application with application exit or in-game exit button [MTT-7003] (#863)
* unsubscription on application.wantstoquit to avoid infinite loop * changelog addition * code formatting
1 parent 774b3f8 commit 910d6c2

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Assets/Scripts/ApplicationLifecycle/ApplicationController.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@
1717

1818
namespace Unity.BossRoom.ApplicationLifecycle
1919
{
20-
2120
/// <summary>
2221
/// An entry point to the application, where we bind all the common dependencies to the root DI scope.
2322
/// </summary>
2423
public class ApplicationController : LifetimeScope
2524
{
26-
[SerializeField] UpdateRunner m_UpdateRunner;
27-
[SerializeField] ConnectionManager m_ConnectionManager;
28-
[SerializeField] NetworkManager m_NetworkManager;
25+
[SerializeField]
26+
UpdateRunner m_UpdateRunner;
27+
[SerializeField]
28+
ConnectionManager m_ConnectionManager;
29+
[SerializeField]
30+
NetworkManager m_NetworkManager;
2931

3032
LocalLobby m_LocalLobby;
3133
LobbyServiceFacade m_LobbyServiceFacade;
@@ -116,17 +118,21 @@ private IEnumerator LeaveBeforeQuit()
116118
{
117119
Debug.LogError(e.Message);
118120
}
121+
119122
yield return null;
120123
Application.Quit();
121124
}
122125

123126
private bool OnWantToQuit()
124127
{
128+
Application.wantsToQuit -= OnWantToQuit;
129+
125130
var canQuit = string.IsNullOrEmpty(m_LocalLobby?.LobbyID);
126131
if (!canQuit)
127132
{
128133
StartCoroutine(LeaveBeforeQuit());
129134
}
135+
130136
return canQuit;
131137
}
132138

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ Additional documentation and release notes are available at [Multiplayer Documen
1313
* Upgraded Authentication Service package to v2.7.1
1414
* Upgraded Boss Room to Netcode for GameObjects v1.6.0 (#865)
1515
* A package Version Define has been created for Netcode for GameObjects v.1.5.2 - v1.6.0. Recent refactorings to NetworkManager's shutdown have prevented the ability to invoke CustomMessages when OnClientDisconnected callbacks are invoked during a shutdown as host. This regression has caused one of our runtime tests, namely Unity.BossRoom.Tests.Runtime.ConnectionManagementTests.UnexpectedServerShutdown_ClientsFailToReconnect, to fail and it does not impact gameplay. This is a known issue and will be addressed in a future NGO version.
16-
17-
### Changed
1816
* Upgraded to Lobby 1.1.0 (#860).
1917
* Lobbies are now locked when being created and are only unlocked when the relay allocation is ready.
2018
* Removed explicit reference to Wire in the package manifest, since Wire is already a dependency of Lobby
2119

2220
### Fixed
2321
* Fixed colliders on diagonal walls to not have negative scale (#854).
2422
* Unnecessary update requests are no longer being sent to Lobby after receiving update events from the service (#860).
23+
* Fixed a condition where one would be unable to quit the application through OS-level quit button, nor the in-game quit button (#863)
2524

2625
## [2.2.0] - 2023-07-06
2726

0 commit comments

Comments
 (0)