#Multiple event readers

3 messages · Page 1 of 1 (latest)

latent nest
#

If I have multiple functions that act upon an event, can only one function read that event or can all of them do that? Because .read() just reads events, it has not read yet.

impl<'w, 's, E: Event> EventReader<'w, 's, E> {
    /// Iterates over the events this [`EventReader`] has not seen yet. This updates the
    /// [`EventReader`]'s event counter, which means subsequent event reads will not include events
    /// that happened before now.
    pub fn read(&mut self) -> EventIterator<'_, E> {
        self.reader.read(&self.events)
    }
iron patrol
#

each EventReader gets its own copy of all events, and its .read() is local to its copy of the events

#

so multiple systems can read the same event