diff --git a/src/Collections/IndexableSet.cs b/src/Collections/IndexableSet.cs index 140f9f5..6eaee89 100644 --- a/src/Collections/IndexableSet.cs +++ b/src/Collections/IndexableSet.cs @@ -61,6 +61,7 @@ namespace MoonTools.ECS.Collections return false; } + /* var index = indices[element]; if (index != Count - 1) @@ -71,6 +72,18 @@ namespace MoonTools.ECS.Collections } count -= 1; indices.Remove(element); + */ + + var index = indices[element]; + + for (var i = index; i < Count - 1; i += 1) + { + array[i] = array[i + 1]; + indices[array[i]] = i; + } + + indices.Remove(element); + count -= 1; return true; }