diff --git a/crates/bevy_sprite/src/render/mod.rs b/crates/bevy_sprite/src/render/mod.rs index 878c65a46e10d..c61ca969f2254 100644 --- a/crates/bevy_sprite/src/render/mod.rs +++ b/crates/bevy_sprite/src/render/mod.rs @@ -322,7 +322,7 @@ pub fn prepare_sprites( // sort first by z and then by handle. this ensures that, when possible, batches span multiple z layers // batches won't span z-layers if there is another batch between them - extracted_sprites.sprites.sort_by(|a, b| { + extracted_sprites.sprites.sort_unstable_by(|a, b| { match a.transform.w_axis[2].partial_cmp(&b.transform.w_axis[2]) { Some(Ordering::Equal) | None => a.handle.cmp(&b.handle), Some(other) => other,