I’m running into assertion errors when trying to deserialize my world.
I have two different types of shared component data that can both have values of 0,0. One is an ID struct, the other is a Sector struct. Due to the way the deserializer is written, when it creates hash codes for these they both equal 0. This causes the deserialization to bomb out due to an assertion failure.
public static unsafe int DeserializeSharedComponents(EntityManager entityManager, BinaryReader reader)
{
int storedVersion = reader.ReadInt();
if (storedVersion != CurrentFileFormatVersion)
{
throw new ArgumentException(
$"Attempting to read a entity scene stored in an old file format version (stored version : {storedVersion}, current version : {CurrentFileFormatVersion})");
}
int numSharedComponents = reader.ReadInt();
for (int i = 0; i < numSharedComponents; ++i)
{
SharedComponentRecord record = new SharedComponentRecord();
reader.ReadBytes(&record, sizeof(SharedComponentRecord));
var buffer = new byte[record.ComponentSize];
reader.ReadBytes(UnsafeUtility.AddressOf(ref buffer[0]), record.ComponentSize);
var typeIndex = TypeManager.GetTypeIndexFromStableTypeHash(record.StableTypeHash);
var data = TypeManager.ConstructComponentFromBuffer(typeIndex, UnsafeUtility.AddressOf(ref buffer[0]));
// TODO: this recalculation should be removed once we merge the NET_DOTS and non NET_DOTS hashcode calculations
var hashCode = TypeManager.GetHashCode(data, typeIndex); // record.hashCode;
int index = entityManager.ManagedComponentStore.InsertSharedComponentAssumeNonDefault(typeIndex, hashCode, data);
Assert.AreEqual(i + 1, index);
}
return numSharedComponents;
}
I can’t write custom HashCode functions for the different component types to offset their values because it calls an internal GetHashCode function.
Has this been changed in the upcoming release?

