From b6da40cfe6d3686ef01b8708dc8e6f5c66229bdc Mon Sep 17 00:00:00 2001 From: Chia-Hsiang Cheng <88014292+garychia@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:32:57 +0800 Subject: [PATCH] Print a warning for un-applied commands being dropped from a CommandQueue (#11146) # Objective - Fixes #11125 ## Solution Add a warning for un-applied commands to the `drop` function. --- crates/bevy_ecs/src/system/commands/command_queue.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/bevy_ecs/src/system/commands/command_queue.rs b/crates/bevy_ecs/src/system/commands/command_queue.rs index f68031c3d39b0..5130089cc8fd2 100644 --- a/crates/bevy_ecs/src/system/commands/command_queue.rs +++ b/crates/bevy_ecs/src/system/commands/command_queue.rs @@ -1,6 +1,7 @@ use std::mem::MaybeUninit; use bevy_ptr::{OwningPtr, Unaligned}; +use bevy_utils::tracing::warn; use super::Command; use crate::world::World; @@ -161,6 +162,9 @@ impl CommandQueue { impl Drop for CommandQueue { fn drop(&mut self) { + if !self.bytes.is_empty() { + warn!("CommandQueue has un-applied commands being dropped."); + } self.apply_or_drop_queued(None); } }