Reading from component of one entity, and writing to the component of another entity

What I’m trying to achieve: I’ve got an event entity that contains a movement direction I want to apply to another entity that has ControlledByEdge + MoveByDirection components attached to it.

So, I’ve got an entity that contains direction:

[WriteGroup(typeof(MoveByDirection))]
public struct EdgeDetected : IComponentData {
        public float2 EdgeDirection;
}

In case this entity (EdgeDetected) is present in the world, I want to update the entity that have:

public struct ControlledByEdge : IComponentData {
}

And

public struct MoveByDirection : IComponentData {
        public float3 Direction;
        public float Speed;
}

attached to it, like so:

[UpdateBefore(typeof(MoveByDirectionSystem))]
    public class ApplyEdgeDirSystem : JobComponentSystem {
        protected override void OnCreate() {
            var queryDescription = new EntityQueryDesc {
                                                           All = typeof(EdgeDetected),
                                                           Options = EntityQueryOptions.FilterWriteGroup
                                                       };
            GetEntityQuery(queryDescription);
        }

        protected override JobHandle OnUpdate(JobHandle inputDeps) {
            Debug.Log("Running");
            // Apply direction changes afterwards to the controlled by entities
            return new ApplyDirection().Schedule(this, inputDeps);
        }

        [BurstCompile]
        [RequireComponentTag(typeof(ControlledByEdge))]
        private struct ApplyDirection : IJobForEach<EdgeDetected, MoveByDirection> {
            public void Execute([ReadOnly] ref EdgeDetected edge, ref MoveByDirection dir) {
                float2 edgeDir = edge.EdgeDirection;
                dir.Direction = new float3(edgeDir.x, 0, edgeDir.y);
            }
        }
    }

However, the system never rans, even if the EdgeDetected component on the separate entity in the world is present. Do they have to be on the same entity (as ControlledByEdge + MoveDirection) in order for the system to run?

I bet there’s a simpler way to do this, but I’ve got no idea how.

I could’ve in theory, add direction to the ControlledByEdge component, write to it, and then update just by ControlledByEdge + MoveByDirection. But that would cause for that system to run each frame, moving data from ControlledByEdge → MoveByDirection, which is undesired.

Ok, nvm, I could’ve just writed directly to the MoveByDirection + tagged component + job instead, which more simpler, and doesn’t consume performance of ECB.

Rubber forum programming techniques.