Skip to content

Commit

Permalink
fix: fix remote sync by updating onDestroy (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesDaiii authored and EdwardLu2018 committed Nov 23, 2023
1 parent 554e808 commit a932d22
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Runtime/Scripts/RenderFusion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ private void Start()
StartCoroutine(SetupSignaling());
}

private void OnDestroy()
{
timer.Dispose();
}

private IEnumerator SetupSignaling()
{
var scene = ArenaClientScene.Instance;
Expand Down Expand Up @@ -143,6 +138,15 @@ private void RemovePeerConnection(string id)
else
Debug.LogWarning($"Peer {id} not found in dictionary.");
}
private void OnDestroy()
{
var keysToRemove = clientPeerDict.Keys.ToList();
foreach (var id in keysToRemove)
{
RemovePeerConnection(id);
}
timer.Dispose();
}

private void OnClientConnect(ISignaling signaler, ConnectData data)
{
Expand Down

0 comments on commit a932d22

Please sign in to comment.