Skip to main content

Crate bevy_extract

Crate bevy_extract 

Source
Expand description

This crate provides a way to extract component information from an app’s main world into a sub world.

The easiest way to set up extract is to add the ExtractPlugin for your AppLabel.

Then derive ExtractComponent or ExtractResource - ensure that you specify the extract_app attribute.

ⓘ
#[derive(Component, Clone, Debug, ExtractComponent)]
#[extract_app(SomeApp)]
struct SomeComponent;

This adds SyncComponent to first sync the entities from the main world to the sub world. And then sync the component data from the main entity to the sub entity.

More complex use cases may want to manually implement the ExtractComponent or ExtractResource traits directly.

For higher performance needs use the ExtractInstance trait.

The sub app can access the main world in the ExtractSchedule. Adding a system with a query wrapped in Extract and it will run against the main app world.

Re-exports§

pub use extract_param::Extract;
pub use extract_plugin::ExtractSchedule;
pub use extract_plugin::MainWorld;
pub use extract_plugin::*;
pub use sync_world::*;

Modules§

extract_component
extract_instances
Convenience logic for turning components from the main world into extracted instances in the sub world.
extract_param
extract_plugin
extract_resource
sync_component
sync_world