From 01177cd5e76d3c38c38e4c2a22c19238a2077677 Mon Sep 17 00:00:00 2001 From: Austin Smith Date: Thu, 29 Feb 2024 10:55:00 -0600 Subject: [PATCH 1/3] Add public property Id to world. --- source/DefaultEcs/World.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/DefaultEcs/World.cs b/source/DefaultEcs/World.cs index 329cf7d..a845347 100644 --- a/source/DefaultEcs/World.cs +++ b/source/DefaultEcs/World.cs @@ -171,6 +171,11 @@ public void Dispose() /// public int MaxCapacity { get; } + /// + /// Gets the unique id of the world instance. + /// + public int Id => WorldId; + #endregion #region Initialisation From 73f158ab1c29e909f50b78c9de23747a9d934965 Mon Sep 17 00:00:00 2001 From: Austin Smith Date: Fri, 1 Mar 2024 10:13:07 -0600 Subject: [PATCH 2/3] change world property Id to use GetHashCode() --- source/DefaultEcs/World.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/DefaultEcs/World.cs b/source/DefaultEcs/World.cs index a845347..9c8d646 100644 --- a/source/DefaultEcs/World.cs +++ b/source/DefaultEcs/World.cs @@ -174,7 +174,7 @@ public void Dispose() /// /// Gets the unique id of the world instance. /// - public int Id => WorldId; + public int Id => GetHashCode(); #endregion From 22638a88fc1587ada068e5f1d147b9d6fea643dc Mon Sep 17 00:00:00 2001 From: Austin Smith Date: Fri, 1 Mar 2024 10:21:14 -0600 Subject: [PATCH 3/3] add GetHashCode override to world class --- source/DefaultEcs/World.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/DefaultEcs/World.cs b/source/DefaultEcs/World.cs index 9c8d646..816bea6 100644 --- a/source/DefaultEcs/World.cs +++ b/source/DefaultEcs/World.cs @@ -172,7 +172,7 @@ public void Dispose() public int MaxCapacity { get; } /// - /// Gets the unique id of the world instance. + /// Gets the unique id of the world instance. /// public int Id => GetHashCode(); @@ -804,6 +804,15 @@ public void Dispose() /// A string representing this instance. public override string ToString() => $"World {WorldId}"; + /// + /// Returns a hashcode representing this instance. + /// + /// A hashcode representing this instance. + public override int GetHashCode() + { + return WorldId.GetHashCode(); + } + #endregion } }