From f7fe0e63b16a076e411f37864c371fdbd083e7df Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Wed, 23 Nov 2022 00:18:13 +0000 Subject: [PATCH] Remove warning about missed events due to false positives (#6730) # Objective - Reverts #5730. - Fixes #6173, fixes #6596. ## Solution Remove the warning entirely. ## Changelog You will no longer be spammed about > Missed 31 `bevy_input::mouse::MouseMotion` events. Consider reading from the `EventReader` more often (generally the best solution) or calling Events::update() less frequently (normally this is called once per frame). This problem is most likely due to run criteria/fixed timesteps or consuming events conditionally. See the Events documentation for more information. when you miss events. These warnings were often (but not always) a false positive. You can still check this manually by using `ManualEventReader::missed_events` --- crates/bevy_ecs/src/event.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/crates/bevy_ecs/src/event.rs b/crates/bevy_ecs/src/event.rs index 1c46c90dc0353..f620ee534deb5 100644 --- a/crates/bevy_ecs/src/event.rs +++ b/crates/bevy_ecs/src/event.rs @@ -2,7 +2,7 @@ use crate as bevy_ecs; use crate::system::{Local, Res, ResMut, Resource, SystemParam}; -use bevy_utils::tracing::{trace, warn}; +use bevy_utils::tracing::trace; use std::ops::{Deref, DerefMut}; use std::{fmt, hash::Hash, marker::PhantomData}; @@ -352,15 +352,6 @@ impl ManualEventReader { events: &'a Events, ) -> impl DoubleEndedIterator)> + ExactSizeIterator)> { - // if the reader has seen some of the events in a buffer, find the proper index offset. - // otherwise read all events in the buffer - let missed = self.missed_events(events); - if missed > 0 { - let plural = if missed == 1 { "event" } else { "events" }; - let type_name = std::any::type_name::(); - warn!("Missed {missed} `{type_name}` {plural}. Consider reading from the `EventReader` more often (generally the best solution) or calling Events::update() less frequently (normally this is called once per frame). This problem is most likely due to run criteria/fixed timesteps or consuming events conditionally. See the Events documentation for more information."); - } - let a_index = (self.last_event_count).saturating_sub(events.events_a.start_event_count); let b_index = (self.last_event_count).saturating_sub(events.events_b.start_event_count); let a = events.events_a.get(a_index..).unwrap_or_default();