bevy/crates
Georg Friedrich Schuppe 98a08cf495 feat: remove_component for ReflectComponent (#2682)
# Objective

While implementing a plugin for my rollback networking library, I needed to load/save parts of the world. For this, I made a WorldSnapshot that works quite like the current DynamicScene. Using a TypeRegistry to register component types I want to save/load and then using ReflectComponents methods to add or apply components of the given types. 

However, I noticed there is no method to remove components from entities through the ReflectComponent.

## Solution

I added a `remove_component` field to the `ReflectComponent` struct, as well as a `pub fn remove_component(&self, world: &mut World, entity: Entity)` to call that function in `remove_component`. This follows exactly the same pattern all other methods/fields in this struct look like.

This is an example how it could be used (at least how I would use it):
6c003f86f1/src/world_snapshot.rs (L133)
2021-08-18 20:57:58 +00:00
..
bevy_app Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_asset Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_audio Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_core Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_derive Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_diagnostic Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_dylib Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_dynamic_plugin Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_ecs feat: remove_component for ReflectComponent (#2682) 2021-08-18 20:57:58 +00:00
bevy_gilrs Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_gltf Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_input Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_internal Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_log Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_macro_utils Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_math Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_pbr Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_reflect Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_render System Param Lifetime Split (#2605) 2021-08-15 20:51:53 +00:00
bevy_scene System Param Lifetime Split (#2605) 2021-08-15 20:51:53 +00:00
bevy_sprite Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_tasks Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_text System Param Lifetime Split (#2605) 2021-08-15 20:51:53 +00:00
bevy_transform System Param Lifetime Split (#2605) 2021-08-15 20:51:53 +00:00
bevy_ui System Param Lifetime Split (#2605) 2021-08-15 20:51:53 +00:00
bevy_utils Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_wgpu Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_window Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_winit Not me ... us (#2654) 2021-08-15 20:08:52 +00:00