Skip to content

Commit

Permalink
fix: #573 NullReferenceException because destroyed NetworkIdentities …
Browse files Browse the repository at this point in the history
…were never removed from sceneIds dict
  • Loading branch information
miwarnec committed Mar 24, 2019
1 parent 1e5fc3c commit a2d6317
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Assets/Mirror/Runtime/NetworkIdentity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,12 @@ void SetupIDs()

void OnDestroy()
{
// remove from sceneIds
// -> remove with (0xFFFFFFFFFFFFFFFF) and without (0x00000000FFFFFFFF)
// sceneHash to be 100% safe.
sceneIds.Remove(sceneId);
sceneIds.Remove(sceneId & 0x00000000FFFFFFFF);

if (m_IsServer && NetworkServer.active)
{
NetworkServer.Destroy(gameObject);
Expand Down

0 comments on commit a2d6317

Please sign in to comment.