fix snapshot edge cases + fix debug component list

pull/7/head
cosmonaut 2023-12-20 14:51:19 -08:00
parent 2adecf771a
commit d2b8e68b08
2 changed files with 4 additions and 4 deletions

View File

@ -60,7 +60,7 @@ public class Snapshot : IDisposable
relationStorage.Clear(); relationStorage.Clear();
} }
for (var i = 0; i < world.ComponentIndex.Count; i += 1) for (var i = 0; i < ComponentSnapshots.Count; i += 1)
{ {
var componentStorage = world.ComponentIndex[i]; var componentStorage = world.ComponentIndex[i];
ComponentSnapshots[i].Restore(componentStorage); ComponentSnapshots[i].Restore(componentStorage);
@ -106,10 +106,9 @@ public class Snapshot : IDisposable
} }
// restore entity tags // restore entity tags
world.EntityTags.Clear(); for (var i = 0; i < EntityTags.Count; i += 1)
foreach (var s in EntityTags)
{ {
world.EntityTags.Add(s); world.EntityTags[i] = EntityTags[i];
} }
} }

View File

@ -36,6 +36,7 @@ public class ComponentTypeIdAssigner<T> : ComponentTypeIdAssigner
#if DEBUG #if DEBUG
World.ComponentTypeToId[typeof(T)] = new TypeId(Id); World.ComponentTypeToId[typeof(T)] = new TypeId(Id);
World.ComponentTypeIdToType.Add(typeof(T));
#endif #endif
} }
} }