docs/bevy/release-content/migration-guides/extract-extract.md 1.2 K · 45 lines · raw · history

1 ---
2 title: Extract Extract
3 pull_requests: [24419, 24420, 24423, 22852]
4 ---
5
6 Extraction used to be specific of Main World to Render World, but will now be generic
7
8 - Use `TemporaryRenderEntity::default()` instead of `TemporaryRenderEntity`
9 - When using extraction related traits e.g. `SyncComponent`, `ExtractComponent` and `ExtractResource`,
10 you must specify the `AppLabel` for the target world.
11
12 Before:
13
14 ```rust,ignore
15 impl SyncComponent for TemporalAntiAliasing { ... }
16
17 #[derive(Component, ExtractComponent)]
18 pub struct Foo { ... }
19 ```
20
21 After:
22
23 ```rust,ignore
24 impl SyncComponent<RenderApp> for TemporalAntiAliasing { ... }
25
26 #[derive(Component, ExtractComponent)]
27 #[extract_app(RenderApp)]
28 pub struct Foo { ... }
29 ```
30
31 You can now extract a component from the main subapp to multiple subapps. To extract a component to multiple subapps, list them as arguments to `extract_app`:
32
33 ```rust,ignore
34 #[derive(Component, Clone, Debug, ExtractComponent)]
35 #[extract_app(RenderApp, AudioApp)]
36 struct SomeComponent;
37 ```
38
39 All of the above has moved to the new crate `bevy_extract`.
40
41 Most extraction parts are re-exported by `bevy_render` .
42
43 Some migrations are needed:
44
45 - `bevy_render::extract_plugin::extract()` has moved to `bevy_extract::extract_plugin::extract()`