diff --git a/crates/bevy_ui/src/render/ui_material_pipeline.rs b/crates/bevy_ui/src/render/ui_material_pipeline.rs index e9a3803ebb48b..8ca8d390f87fe 100644 --- a/crates/bevy_ui/src/render/ui_material_pipeline.rs +++ b/crates/bevy_ui/src/render/ui_material_pipeline.rs @@ -642,9 +642,11 @@ pub fn queue_ui_material_nodes( bind_group_data: material.key.clone(), }, ); - transparent_phase - .items - .reserve(extracted_uinodes.uinodes.len()); + if transparent_phase.items.capacity() < extracted_uinodes.uinodes.len() { + transparent_phase.items.reserve_exact( + extracted_uinodes.uinodes.len() - transparent_phase.items.capacity(), + ); + } transparent_phase.add(TransparentUi { draw_function, pipeline,