Search Issue Tracker

Active

Votes

0

Found in [Package]

services-multiplayer-1.1.1

Issue ID

MTTB-1221

Regression

No

[Multiplayer SDK] LobbyChanged callback fired when joining an already unsubscribed Lobby

Package: Multiplayer Services

-

*Steps to reproduce:*

Repro steps are outlined quite nicely in this discussion post:
[https://discussions.unity.com/t/lobby-event-callbacks-are-still-getting-called-after-unsubscribe/1602819/9

Boss Room repro branch:
[https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop/tree/temp/lobby-changed-bug-repro

*Actual results:* 
When joining, the client B sees the following exception (in Boss Room for example), when rejoining the same Lobby:
NullReferenceException: Object reference not set to an instance of an object
LobbyPatcher.ApplyPatchesToLobby (Unity.Services.Lobbies.ILobbyChanges changes, Unity.Services.Lobbies.Models.Lobby lobbyToChange) (at ./Library/PackageCache/com.unity.services.multiplayer/Runtime/Lobbies/SDK/LobbyUpdates/Internal/LobbyPatcher.cs:44)
Unity.Services.Lobbies.LobbyPatcherChanges.ApplyToLobby (Unity.Services.Lobbies.Models.Lobby lobby) (at ./Library/PackageCache/com.unity.services.multiplayer/Runtime/Lobbies/SDK/LobbyUpdates/Internal/LobbyPatcherChanges.cs:179)
Unity.BossRoom.UnityServices.Lobbies.LobbyServiceFacade.OnLobbyChanges (Unity.Services.Lobbies.ILobbyChanges changes) (at /Users/fernando.cortez/boss-room-second-repo/com.unity.multiplayer.samples.coop/Assets/Scripts/UnityServices/Lobbies/LobbyServiceFacade.cs:254)
LobbyEventCallbacks.InvokeLobbyChanged (Unity.Services.Lobbies.ILobbyChanges changes) (at ./Library/PackageCache/com.unity.services.multiplayer/Runtime/Lobbies/SDK/LobbyUpdates/LobbyEventCallbacks.cs:81)
Lobbies.SDK.LobbyCacher.LobbyCacher.UpdateLobbyCache (System.String lobbyId, Unity.Services.Lobbies.ILobbyChanges changes) (at ./Library/PackageCache/com.unity.services.multiplayer/Runtime/Lobbies/SDK/LobbyCacher/LobbyCacher.cs:97)
Lobbies.SDK.LobbyCacher.LobbyCacher.UpdateLobbyCache (System.String lobbyId, Unity.Services.Lobbies.Models.Lobby newLobby) (at ./Library/PackageCache/com.unity.services.multiplayer/Runtime/Lobbies/SDK/LobbyCacher/LobbyCacher.cs:64)
Unity.Services.Lobbies.Internal.WrappedLobbyService.AddOrUpdateLobbyCache (Unity.Services.Lobbies.Models.Lobby newLobby) (at ./Library/PackageCache/com.unity.services.multiplayer/Runtime/Lobbies/SDK/WrappedLobbyService.cs:647)
Unity.Services.Lobbies.Internal.WrappedLobbyService.JoinLobbyByIdAsync (System.String lobbyId, Unity.Services.Lobbies.JoinLobbyByIdOptions options) (at ./Library/PackageCache/com.unity.services.multiplayer/Runtime/Lobbies/SDK/WrappedLobbyService.cs:218)
Unity.BossRoom.UnityServices.Lobbies.LobbyAPIInterface.JoinLobbyById (System.String requesterUasId, System.String lobbyId, System.Collections.Generic.Dictionary`2[TKey,TValue] localUserData) (at /Users/fernando.cortez/boss-room-second-repo/com.unity.multiplayer.samples.coop/Assets/Scripts/UnityServices/Lobbies/LobbyAPIInterface.cs:67)
Unity.BossRoom.UnityServices.Lobbies.LobbyServiceFacade.TryJoinLobbyAsync (System.String lobbyId, System.String lobbyCode) (at /Users/fernando.cortez/boss-room-second-repo/com.unity.multiplayer.samples.coop/Assets/Scripts/UnityServices/Lobbies/LobbyServiceFacade.cs:178)
Unity.BossRoom.Gameplay.UI.LobbyUIMediator.JoinLobbyRequest (Unity.BossRoom.UnityServices.Lobbies.LocalLobby lobby) (at /Users/fernando.cortez/boss-room-second-repo/com.unity.multiplayer.samples.coop/Assets/Scripts/Gameplay/UI/Lobby/LobbyUIMediator.cs:175)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <3aacbe608a2f468eb6bb1c15e219490d>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:156)
UnityEngine.UnitySynchronizationContext.Exec () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:84)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:110)

*Expected results:* 
No LobbyChanged callback is fired for a previously joined lobby with a null Lobby reference.

*Reproducible with versions:* 6000.0.32f1 & Multiplayer Services SDK v1.1.1

*Not reproducible with versions:* 

*Can’t test with versions:* 

*Tested on (OS):* Mac

*Notes:*
*  

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.