Skip to content

Commit 92cd9cc

Browse files
fix: remove OnClientConnectedCallback registration from StatsDisplay (#882)
* style Comments for OnDestroy method * fix Yamato 1 commit problems.
1 parent 5999478 commit 92cd9cc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

testproject/Assets/Tests/Manual/Scripts/StatsDisplay.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public class StatsDisplay : NetworkBehaviour
1818
private Text m_ClientServerToggleText;
1919
private List<ulong> m_ClientsToUpdate = new List<ulong>();
2020

21-
2221
private bool m_IsServer;
2322

2423
private void Start()
@@ -72,6 +71,14 @@ private void OnClientConnectedCallback(ulong clientId)
7271
}
7372
}
7473

74+
/// <summary>
75+
/// Remove our OnClientConnectedCallback registration when we are destroyed
76+
/// </summary>
77+
private void OnDestroy()
78+
{
79+
NetworkManager.OnClientConnectedCallback -= OnClientConnectedCallback;
80+
}
81+
7582
/// <summary>
7683
/// Used by UI Button click event
7784
/// </summary>

0 commit comments

Comments
 (0)