Skip to content
Discussion options

You must be logged in to vote

I believe you're right that accessing an EventReader from an exclusive system requires the use of SystemState. However if all you need is mutable access to the Processor component you can add a Query to the SystemState.

/// Forward inbound commands to their processor
pub fn forward_messages(
    world: &mut World,
    system_state: &mut SystemState<
        EventReader<Command>,
        Res<ApplicationRegistry>,
        Query<&mut Processor>,
    >,
) {
    let (mut evr, registry, mut q_processor) = system_state.get_mut(world);

    // Iterate over all inbound commands
    for command in evr.read() {
        // Use registry to find which entity will process that command
        let target…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rohel01
Comment options

Answer selected by rohel01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants