Skip to content

Commit

Permalink
SceneCompare
Browse files Browse the repository at this point in the history
  • Loading branch information
duyca committed Sep 30, 2023
1 parent bf0ed4b commit 662d7f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions Assets/FishNet/Runtime/Connection/NetworkConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@

namespace FishNet.Connection
{

internal class SceneCompare : IEqualityComparer<Scene>
{
public bool Equals(Scene x, Scene y) => x == y;
public int GetHashCode(Scene obj) => obj.name.GetHashCode();
}
/// <summary>
/// A container for a connected client used to perform actions on and gather information for the declared client.
/// </summary>
Expand Down Expand Up @@ -110,10 +114,11 @@ public void SetFirstObject(NetworkObject nob)

FirstObject = nob;
}

/// <summary>
/// Scenes this connection is in. Available to this connection and server.
/// </summary>
public HashSet<Scene> Scenes { get; private set; } = new HashSet<Scene>();
public HashSet<Scene> Scenes { get; private set; } = new(new SceneCompare());
/// <summary>
/// True if this connection is being disconnected. Only available to server.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Assets/FishNet/Runtime/Managing/Scened/SceneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ internal enum LightProbeUpdateType
/// <summary>
/// Scenes which must be manually unloaded, even when emptied.
/// </summary>
private HashSet<Scene> _manualUnloadScenes = new();
private HashSet<Scene> _manualUnloadScenes = new(new SceneCompare());

/// <summary>
/// Scene containing moved objects when changing single scene. On client this will contain all objects moved until the server destroys them.
Expand Down
2 changes: 1 addition & 1 deletion Assets/FishNet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 662d7f0

Please sign in to comment.