Skip to content

Commit

Permalink
fix: Clean up roomSlots on clients in NetworkRoomPlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Langsenkamp committed Jun 18, 2020
1 parent c14b82c commit 5032ceb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Assets/Mirror/Components/NetworkRoomPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ public void Start()
logger.LogError("RoomPlayer could not find a NetworkRoomManager. The RoomPlayer requires a NetworkRoomManager object to function. Make sure that there is one in the scene.");
}

public virtual void OnDisable()
{
if (NetworkClient.active && NetworkManager.singleton is NetworkRoomManager room)
{
room.roomSlots.Remove(this);
room.RecalculateRoomPlayerIndices();
}
}

#endregion

#region Commands
Expand Down

0 comments on commit 5032ceb

Please sign in to comment.