diff --git a/crates/bevy_pbr/src/render/light.rs b/crates/bevy_pbr/src/render/light.rs index c17b9d9355..6f3216d896 100644 --- a/crates/bevy_pbr/src/render/light.rs +++ b/crates/bevy_pbr/src/render/light.rs @@ -347,7 +347,7 @@ pub fn extract_lights( )); } *previous_point_lights_len = point_lights_values.len(); - commands.insert_or_spawn_batch(point_lights_values); + commands.try_insert_batch(point_lights_values); let mut spot_lights_values = Vec::with_capacity(*previous_spot_lights_len); for entity in global_point_lights.iter().copied() { @@ -410,7 +410,7 @@ pub fn extract_lights( } } *previous_spot_lights_len = spot_lights_values.len(); - commands.insert_or_spawn_batch(spot_lights_values); + commands.try_insert_batch(spot_lights_values); for ( main_entity, diff --git a/crates/bevy_pbr/src/wireframe.rs b/crates/bevy_pbr/src/wireframe.rs index dae770bf25..a8baae9b50 100644 --- a/crates/bevy_pbr/src/wireframe.rs +++ b/crates/bevy_pbr/src/wireframe.rs @@ -167,7 +167,7 @@ fn apply_wireframe_material( let material = get_wireframe_material(maybe_color, &mut materials, &global_material); material_to_spawn.push((e, MeshMaterial3d(material))); } - commands.insert_or_spawn_batch(material_to_spawn); + commands.try_insert_batch(material_to_spawn); } type WireframeFilter = (With, Without, Without); @@ -195,7 +195,7 @@ fn apply_global_wireframe_material( // This makes it easy to detect which mesh is using the global material and which ones are user specified material_to_spawn.push((e, MeshMaterial3d(material))); } - commands.insert_or_spawn_batch(material_to_spawn); + commands.try_insert_batch(material_to_spawn); } else { for e in &meshes_with_global_material { commands diff --git a/crates/bevy_render/src/extract_component.rs b/crates/bevy_render/src/extract_component.rs index f771998428..19d15a2b86 100644 --- a/crates/bevy_render/src/extract_component.rs +++ b/crates/bevy_render/src/extract_component.rs @@ -154,7 +154,7 @@ fn prepare_uniform_components( ) }) .collect::>(); - commands.insert_or_spawn_batch(entities); + commands.try_insert_batch(entities); } /// This plugin extracts the components into the render world for synced entities. @@ -212,7 +212,7 @@ fn extract_components( } } *previous_len = values.len(); - commands.insert_or_spawn_batch(values); + commands.try_insert_batch(values); } /// This system extracts all components of the corresponding [`ExtractComponent`], for entities that are visible and synced via [`crate::sync_world::SyncToRenderWorld`]. @@ -232,5 +232,5 @@ fn extract_visible_components( } } *previous_len = values.len(); - commands.insert_or_spawn_batch(values); + commands.try_insert_batch(values); } diff --git a/crates/bevy_render/src/gpu_component_array_buffer.rs b/crates/bevy_render/src/gpu_component_array_buffer.rs index ac0f471a4a..288b8f2c65 100644 --- a/crates/bevy_render/src/gpu_component_array_buffer.rs +++ b/crates/bevy_render/src/gpu_component_array_buffer.rs @@ -53,7 +53,7 @@ fn prepare_gpu_component_array_buffers( .iter() .map(|(entity, component)| (entity, gpu_array_buffer.push(component.clone()))) .collect::>(); - commands.insert_or_spawn_batch(entities); + commands.try_insert_batch(entities); gpu_array_buffer.write_buffer(&render_device, &render_queue); } diff --git a/crates/bevy_sprite/src/mesh2d/wireframe2d.rs b/crates/bevy_sprite/src/mesh2d/wireframe2d.rs index 6d62a04675..f4b2602bc0 100644 --- a/crates/bevy_sprite/src/mesh2d/wireframe2d.rs +++ b/crates/bevy_sprite/src/mesh2d/wireframe2d.rs @@ -180,7 +180,7 @@ fn apply_wireframe_material( }; wireframes_to_spawn.push((e, MeshMaterial2d(material))); } - commands.insert_or_spawn_batch(wireframes_to_spawn); + commands.try_insert_batch(wireframes_to_spawn); } type Wireframe2dFilter = (With, Without, Without); @@ -209,7 +209,7 @@ fn apply_global_wireframe_material( // This makes it easy to detect which mesh is using the global material and which ones are user specified material_to_spawn.push((e, MeshMaterial2d(global_material.handle.clone()))); } - commands.insert_or_spawn_batch(material_to_spawn); + commands.try_insert_batch(material_to_spawn); } else { for e in &meshes_with_global_material { commands diff --git a/crates/bevy_ui/src/render/box_shadow.rs b/crates/bevy_ui/src/render/box_shadow.rs index 0e50178356..50e602149c 100644 --- a/crates/bevy_ui/src/render/box_shadow.rs +++ b/crates/bevy_ui/src/render/box_shadow.rs @@ -526,7 +526,7 @@ pub fn prepare_shadows( ui_meta.vertices.write_buffer(&render_device, &render_queue); ui_meta.indices.write_buffer(&render_device, &render_queue); *previous_len = batches.len(); - commands.insert_or_spawn_batch(batches); + commands.try_insert_batch(batches); } extracted_shadows.box_shadows.clear(); } diff --git a/crates/bevy_ui/src/render/mod.rs b/crates/bevy_ui/src/render/mod.rs index 1e29575007..04b0835196 100644 --- a/crates/bevy_ui/src/render/mod.rs +++ b/crates/bevy_ui/src/render/mod.rs @@ -1389,7 +1389,7 @@ pub fn prepare_uinodes( ui_meta.vertices.write_buffer(&render_device, &render_queue); ui_meta.indices.write_buffer(&render_device, &render_queue); *previous_len = batches.len(); - commands.insert_or_spawn_batch(batches); + commands.try_insert_batch(batches); } extracted_uinodes.clear(); } diff --git a/crates/bevy_ui/src/render/ui_material_pipeline.rs b/crates/bevy_ui/src/render/ui_material_pipeline.rs index 8267668c0b..2162b92373 100644 --- a/crates/bevy_ui/src/render/ui_material_pipeline.rs +++ b/crates/bevy_ui/src/render/ui_material_pipeline.rs @@ -578,7 +578,7 @@ pub fn prepare_uimaterial_nodes( } ui_meta.vertices.write_buffer(&render_device, &render_queue); *previous_len = batches.len(); - commands.insert_or_spawn_batch(batches); + commands.try_insert_batch(batches); } extracted_uinodes.uinodes.clear(); } diff --git a/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs b/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs index 6e91bcfcfe..68c6a4a3ef 100644 --- a/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs +++ b/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs @@ -649,7 +649,7 @@ pub fn prepare_ui_slices( ui_meta.vertices.write_buffer(&render_device, &render_queue); ui_meta.indices.write_buffer(&render_device, &render_queue); *previous_len = batches.len(); - commands.insert_or_spawn_batch(batches); + commands.try_insert_batch(batches); } extracted_slices.slices.clear(); } diff --git a/examples/2d/mesh2d_manual.rs b/examples/2d/mesh2d_manual.rs index ca99a71ba0..e203a3668a 100644 --- a/examples/2d/mesh2d_manual.rs +++ b/examples/2d/mesh2d_manual.rs @@ -357,7 +357,7 @@ pub fn extract_colored_mesh2d( ); } *previous_len = values.len(); - commands.insert_or_spawn_batch(values); + commands.try_insert_batch(values); } /// Queue the 2d meshes marked with [`ColoredMesh2d`] using our custom pipeline and draw function