Skip to content

Commit 2c8ffac

Browse files
moving unsubscription to when session not null
1 parent 911643f commit 2c8ffac

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Assets/Scripts/UnityServices/Sessions/MultiplayerServicesFacade.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void BeginTracking()
7878
if (!m_IsTracking)
7979
{
8080
m_IsTracking = true;
81-
SubscribeToJoinedSessionAsync();
81+
SubscribeToJoinedSession();
8282
}
8383
}
8484

@@ -91,11 +91,11 @@ public void EndTracking()
9191
if (m_IsTracking)
9292
{
9393
m_IsTracking = false;
94-
UnsubscribeFromJoinedSessionAsync();
9594
}
9695

9796
if (CurrentUnitySession != null)
9897
{
98+
UnsubscribeFromJoinedSession();
9999
if (m_LocalUser.IsHost)
100100
{
101101
DeleteSessionAsync();
@@ -232,7 +232,7 @@ void ResetSession()
232232
// no need to disconnect Netcode, it should already be handled by Netcode's callback to disconnect
233233
}
234234

235-
void SubscribeToJoinedSessionAsync()
235+
void SubscribeToJoinedSession()
236236
{
237237
CurrentUnitySession.Changed += OnSessionChanged;
238238
CurrentUnitySession.StateChanged += OnSessionStateChanged;
@@ -244,7 +244,7 @@ void SubscribeToJoinedSessionAsync()
244244
CurrentUnitySession.SessionPropertiesChanged += OnSessionPropertiesChanged;
245245
}
246246

247-
void UnsubscribeFromJoinedSessionAsync()
247+
void UnsubscribeFromJoinedSession()
248248
{
249249
CurrentUnitySession.Changed -= OnSessionChanged;
250250
CurrentUnitySession.StateChanged -= OnSessionStateChanged;

0 commit comments

Comments
 (0)