Lambda Job RW/RO

Have some Entities 0.5.0 syntax questions

So as far as I can tell with the new lambda syntax the GetEntityQuery is handled for me BUT can someone please explain to me why my TilesBufferComponent (IBufferElementData) become RW in this lambda query and why do I see bot a RW and and RO ?

The other issues im having is im only wanting to run this job when the TilesBufferComponent changes so im using WithChangeFilter(). Problems im seeing is that var eTiles = _qTiles.ToEntityArray(Allocator.TempJob); sit outside for the lambda and called every frame. What would be the best way to handle this case. Is the correct way to handle this with
if(_qTiles.CalculateEntityCount() > 0) { // Then lambda job}

protected override void OnCreate()
{
    base.OnCreate();
    _ecbs = EntityManager.World.GetOrCreateSystem<BeginSimulationEntityCommandBufferSystem>();

    _qTiles = GetEntityQuery(typeof(TilePositionComponents),
        typeof(TileConnectedTrisComponents));
        //typeof(PlanetTagPlanetId));

    _qTileBuffer = GetEntityQuery(ComponentType.ReadOnly<TilesBufferComponent>());
}

protected override JobHandle OnUpdate(JobHandle inputDeps)
{

    var ecb = _ecbs.CreateCommandBuffer().ToConcurrent();
    var  eTiles = _qTiles.ToEntityArray(Allocator.TempJob);

    var jobHandle = Entities
        .ForEach((int entityInQueryIndex, in DynamicBuffer<TilesBufferComponent> buffer) =>
        {
            for (var i = 0; i < buffer.Length; i++)
            {
                var e = eTiles[i];
                ecb.SetComponent(entityInQueryIndex, e, new TilePositionComponents
                {
                    Position = new float3(
                        buffer[i].PositionX,
                        buffer[i].PositionY,
                        buffer[i].PositionZ)
                });
            }
        })
        .WithReadOnly(eTiles)
        .WithChangeFilter<TilesBufferComponent>()
        .WithName("SetTiles_JOB_TEST")
        .Schedule(inputDeps);

    jobHandle.Complete();
    eTiles.Dispose(jobHandle);

    _ecbs.AddJobHandleForProducer(jobHandle);

    return default;
}

The one below says Triangle and not Tiles ?

lol … ok one issues solved thank you. Do you know why the tile buffer is set to RW by any chance? For GetEntityQuery im using :

_qTileBuffer = GetEntityQuery(ComponentType.ReadOnly<TilesBufferComponent>());

My many in arguments also show up as RW currently in 0.4.0.

As for CalculateEntityCount alternative you can use RequireForUpdate in OnCreate with the EQ that came from .WithStoreEntityQueryInField of the lambda. It will overwrite all implicit EQ update condition of the system (other 2 GetEntityQuery you have).

Thanks for the reply,

Whats the difference between using

_qTrianglesBuffer = GetEntityQuery(ComponentType.ReadOnly<TriangleBufferComponent>());
_qTrianglesBuffer.SetChangedVersionFilter(typeof(TriangleBufferComponent));

and

_qTrianglesBuffer = GetEntityQuery(ComponentType.ReadOnly<TriangleBufferComponent>());
RequireForUpdate(_qTrianglesBuffer);

When do I use what

It’s not the same thing, you can also set filter, then set the EQ with that filter as required for update.

EQ in the require list take over all others (that got added implicitly when you do GetEntityQuery). So if you have other GetEntityQuery the system still follow only this one EQ. (with or without change version filter, doesnt matter)