diff --git a/crates/bevy_render/src/mesh/allocator.rs b/crates/bevy_render/src/mesh/allocator.rs index 218e19c475..94186517a4 100644 --- a/crates/bevy_render/src/mesh/allocator.rs +++ b/crates/bevy_render/src/mesh/allocator.rs @@ -588,6 +588,12 @@ impl MeshAllocator { } for empty_slab in empty_slabs { + self.slab_layouts.values_mut().for_each(|slab_ids| { + let idx = slab_ids.iter().position(|&slab_id| slab_id == empty_slab); + if let Some(idx) = idx { + slab_ids.remove(idx); + } + }); self.slabs.remove(&empty_slab); } }