From 662d7f0452a50e582f6be91fc74f3f9023021e7d Mon Sep 17 00:00:00 2001 From: DuyCa Date: Sat, 30 Sep 2023 13:52:53 +0700 Subject: [PATCH] SceneCompare --- Assets/FishNet/Runtime/Connection/NetworkConnection.cs | 9 +++++++-- Assets/FishNet/Runtime/Managing/Scened/SceneManager.cs | 2 +- Assets/FishNet/package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Assets/FishNet/Runtime/Connection/NetworkConnection.cs b/Assets/FishNet/Runtime/Connection/NetworkConnection.cs index 64a769cf..b50e20ab 100644 --- a/Assets/FishNet/Runtime/Connection/NetworkConnection.cs +++ b/Assets/FishNet/Runtime/Connection/NetworkConnection.cs @@ -11,7 +11,11 @@ namespace FishNet.Connection { - + internal class SceneCompare : IEqualityComparer + { + public bool Equals(Scene x, Scene y) => x == y; + public int GetHashCode(Scene obj) => obj.name.GetHashCode(); + } /// /// A container for a connected client used to perform actions on and gather information for the declared client. /// @@ -110,10 +114,11 @@ public void SetFirstObject(NetworkObject nob) FirstObject = nob; } + /// /// Scenes this connection is in. Available to this connection and server. /// - public HashSet Scenes { get; private set; } = new HashSet(); + public HashSet Scenes { get; private set; } = new(new SceneCompare()); /// /// True if this connection is being disconnected. Only available to server. /// diff --git a/Assets/FishNet/Runtime/Managing/Scened/SceneManager.cs b/Assets/FishNet/Runtime/Managing/Scened/SceneManager.cs index f8b2d90f..d4e9dca9 100644 --- a/Assets/FishNet/Runtime/Managing/Scened/SceneManager.cs +++ b/Assets/FishNet/Runtime/Managing/Scened/SceneManager.cs @@ -189,7 +189,7 @@ internal enum LightProbeUpdateType /// /// Scenes which must be manually unloaded, even when emptied. /// - private HashSet _manualUnloadScenes = new(); + private HashSet _manualUnloadScenes = new(new SceneCompare()); /// /// Scene containing moved objects when changing single scene. On client this will contain all objects moved until the server destroys them. diff --git a/Assets/FishNet/package.json b/Assets/FishNet/package.json index 950bf8fe..a5792303 100644 --- a/Assets/FishNet/package.json +++ b/Assets/FishNet/package.json @@ -2,7 +2,7 @@ "name": "com.fishnet", "displayName": "FishNet - Unity Networking Evolved", "description": "FishNet - Unity Networking Evolved", - "version": "3.7.17", + "version": "3.7.18", "unity": "2021.3", "license": "MIT", "repository": {