Skip to main content

Crate extract

Crate 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.

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

Structs§

Extract
A helper for accessing MainWorld content using a system parameter.
ExtractPlugin
Plugin that sets up the sub app for the AppLabel and handles extracting data from the main world to the sub world.
ExtractSchedule
Schedule in which data from the main world is ‘extracted’ into the sub world.
MainEntity
Component added on the sub world entities to keep track of the corresponding main world entity.
MainWorld
The simulation World of the application, stored as a resource.
SubEntity
Component added on the main world entities that are synced to the Sub World in order to keep track of the corresponding sub world entity.
SyncToSubWorld
Marker component that indicates that its entity needs to be synchronized to the sub world.
SyncWorldPlugin
A plugin that synchronizes entities with SyncToSubWorld between the main world and the sub world.
TemporaryEntity
Marker component that indicates that its entity needs to be despawned at the end of the frame.

Functions§

extract
Executes the ExtractSchedule step of the processor. This updates the sub world with the extracted ECS data of the current frame.

Type Aliases§

MainEntityHashMap
A HashMap pre-configured to use EntityHash hashing with a MainEntity.
MainEntityHashSet
A HashSet pre-configured to use EntityHash hashing with a MainEntity.