EntityQueryMask is not working on subscene entities

ticket: 1267604_lf7a5ohr9r1c2gi9

  1. What happened
    EntityQueryMask.Matches on entity of sub scene always return false.

  2. How we can reproduce it using the example you attached
    Running SampleScene and observe there’s no logs in console window while only the “SubSceneEntity” is enabled.
    Try to enable Entity outside of subscene, and now there’s logs show up in console window.

6159730–673414–Archive.zip (28.6 KB)

I just get this error in console trying to convert your scene.

What are you trying to do here? I’d be shocked if you could actually store a copy of EntityComponentStore* in a subscene… (which is what EntityQueryMask holds)

I am trying to create a dynamic EntityQueryMask and store the mask inside a component data, that I could use to filter entities in system.
It works fine without subscene. But QueryMaskArray of Archetype always return a different bits for entity in subscene even the archetype should be the same as the entity outside of subscene.
6160288--673543--upload_2020-8-2_22-4-37.png

What do you mean by “… EntityComponentStore* in a subscene”? Do you mean “the EntityQueryMask should not be used in subscene because EntityComponentStore cannot be stored in subscene”?

For console error, which version of unity do you use? I only test this on 2020.1.0f1.

Okay, seems I should use World.DefaultGameObjectInjectionWorld.EntityManager instead of dstManager from SubScene world to create mask.
Because, as @tertle said, EntityComponentStore* point to different place between two worlds, which eventually get wrong archetype of entity since entity index is not the same in those two worlds.

Besides that, the QueryMaskArray is also not set with the right mask between two worlds.