private static async Task SubscribeToLobbyEvent(string localLobbyId, LobbyEventCallbacks callbacks)
{
try
{
Debug.Log("[LobbyManager] Subscribing to lobby callbacks started. {_lobby}.");
await Lobbies.Instance.SubscribeToLobbyEventsAsync(localLobbyId, callbacks);
Debug.Log(β[LobbyManager] Subscribing to lobby callbacks ended. {_lobby}.β);
}
catch (LobbyServiceException ex)
{
Debug.Log("[LobbyManager] Subscribing to lobby callbacks failed. {_lobby}.");
switch (ex.Reason)
{
case LobbyExceptionReason.AlreadySubscribedToLobby:
Debug.LogWarning(
β[LobbyManager] Already subscribed to lobby[{localLobbyId}]. We did not need to try and subscribe again. Exception Message: {ex.Message}β);
break;
case LobbyExceptionReason.SubscriptionToLobbyLostWhileBusy:
Debug.LogError( "[LobbyManager] Subscription to lobby events was lost while it was busy trying to subscribe. Exception Message: {ex.Message}");
callbacks.LobbyChanged -= OnLobbyChanged;
throw;
case LobbyExceptionReason.LobbyEventServiceConnectionError:
Debug.LogError(β[LobbyManager] Failed to connect to lobby events. Exception Message: {ex.Message}β);
callbacks.LobbyChanged -= OnLobbyChanged;
throw;
default:
callbacks.LobbyChanged -= OnLobbyChanged;
throw;
}
}
In some cases my game stuck in await Lobbies.Instance.SubscribeToLobbyEventsAsync(localLobbyId, callbacks); it doesnβt catch any exception and not printing the log after it anyone can know what is the issue ?
Hey everyone, apologies for the belated reply to this thread.
While we recommend using the Multiplayer Services SDK for new projects, we also understand that this may not be practical for existing code.
Given that, we have not been able to replicate this issue using the attached code, which is a modified version of what was originally provided. We have tested in a URP template using both the standalone Lobby package (1.2.2) and the bundled package in Multiplayer Services SDK (v1.1.0) with Unity 6000.0.23f1, and the standalone package with 2022.3.39f1 and 2021.3.34f1.
If you continue to experience issues with await LobbyService.Instance.SubscribeToLobbyEventsAsync, please provide your:
Unity version(s)
Lobby version(s)
Operating system
Region and network conditions (e.g. Europe using VPN)