After serialization/deserialization indexed components don't work
[Fact]
public void AddTwoEntitiesWithDifferentIndexesThenSaveIt_ShouldReturnSingleIndexedValue()
{
var id1 = Guid.NewGuid().ToString();
var id2 = Guid.NewGuid().ToString();
var store = new EntityStore();
var entityA = store.CreateEntity();
entityA.AddComponent(new Index() { value = id1 });
var entityB = store.CreateEntity();
entityB.AddComponent(new Index() { value = id2 });
var newStoreEntity1 = store.GetEntitiesWithComponentValue<Index,string>(id1).ToArray();
newStoreEntity1.Length.Should().Be(1); // THIS OK
using var stream = new MemoryStream();
var serializer = new EntitySerializer();
serializer.WriteStore(store,stream);
var readStore = new EntityStore();
serializer.ReadIntoStore(readStore, stream);
readStore.Count.Should().Be(2);
var readEntity1 = readStore.GetEntitiesWithComponentValue<Index,string>(id1).ToArray();
readEntity1.Length.Should().Be(1); // THIS FAILED
}
private struct Index() : IIndexedComponent<string>
{
public string value;
public string GetIndexedValue() => value;
}
After serialization/deserialization indexed components don't work