Hello
While working on World serialize/deserialize, I ended up with something mostly working except the call to EntityManager.MoveEntitiesFrom throwing this exception:
EntityManager.MoveEntitiesFrom failed - All ISharedComponentData references must be from EntityManager. (For example EntityQuery.SetFilter with a shared component type is not allowed during EntityManager.MoveEntitiesFrom)
Looking into it, it seems that the internal function ManagedComponentStore.AllSharedComponentReferencesAreFromChunks always returns false when there are any shared components. This can easily be confirmed by adding this line of code into the OnUpdate of a system:
new EntityManager.EntityManagerDebug(EntityManager).CheckInternalConsistency();
I tried this in our project, in Boids from EntityComponentSystemSamples and in CombatBees from DOTS-training-samples. All resulted with the exception below:
Assertion failure. Value was False
Expected: True
…
0x000002EE2CC2998B (Mono JIT Code) [Assert.cs:15] Unity.Assertions.Assert:IsTrue (bool)
0x000002EE4CF67663 (Mono JIT Code) [EntityManagerDebug.cs:240] Unity.Entities.EntityManager/EntityManagerDebug:CheckInternalConsistency ()
0x000002EE4CF66EA3 (Mono JIT Code) [SomeSystem.cs] SomeSystem:OnUpdate ()
0x000002EE4CF09E8B (Mono JIT Code) [ComponentSystem.cs:818] Unity.Entities.ComponentSystem:InternalUpdate ()
…
Tested in 2019.1.8f1 with Entities preview.33 - 0.0.12.