mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
484721be80
# Objective Fixes #14883 ## Solution Pretty simple update to `EntityCommands` methods to consume `self` and return it rather than taking `&mut self`. The things probably worth noting: * I added `#[allow(clippy::should_implement_trait)]` to the `add` method because it causes a linting conflict with `std::ops::Add`. * `despawn` and `log_components` now return `Self`. I'm not sure if that's exactly the desired behavior so I'm happy to adjust if that seems wrong. ## Testing Tested with `cargo run -p ci`. I think that should be sufficient to call things good. ## Migration Guide The most likely migration needed is changing code from this: ``` let mut entity = commands.get_or_spawn(entity); if depth_prepass { entity.insert(DepthPrepass); } if normal_prepass { entity.insert(NormalPrepass); } if motion_vector_prepass { entity.insert(MotionVectorPrepass); } if deferred_prepass { entity.insert(DeferredPrepass); } ``` to this: ``` let mut entity = commands.get_or_spawn(entity); if depth_prepass { entity = entity.insert(DepthPrepass); } if normal_prepass { entity = entity.insert(NormalPrepass); } if motion_vector_prepass { entity = entity.insert(MotionVectorPrepass); } if deferred_prepass { entity.insert(DeferredPrepass); } ``` as can be seen in several of the example code updates here. There will probably also be instances where mutable `EntityCommands` vars no longer need to be mutable. |
||
---|---|---|
.. | ||
2d_shapes.rs | ||
2d_viewport_to_world.rs | ||
bloom_2d.rs | ||
bounding_2d.rs | ||
custom_gltf_vertex_attribute.rs | ||
mesh2d.rs | ||
mesh2d_alpha_mode.rs | ||
mesh2d_arcs.rs | ||
mesh2d_manual.rs | ||
mesh2d_vertex_color_texture.rs | ||
move_sprite.rs | ||
pixel_grid_snap.rs | ||
rotation.rs | ||
sprite.rs | ||
sprite_animation.rs | ||
sprite_flipping.rs | ||
sprite_sheet.rs | ||
sprite_slice.rs | ||
sprite_tile.rs | ||
text2d.rs | ||
texture_atlas.rs | ||
transparency_2d.rs | ||
wireframe_2d.rs |