bevy_render::extract_component

Derive Macro ExtractComponent

Source
#[derive(ExtractComponent)]
{
    // Attributes available to this derive:
    #[extract_component_filter]
}
Expand description

Implements ExtractComponent trait for a component. The component must implement [Clone]. The component will be extracted into the render world via cloning. Note that this only enables extraction of the component, it does not execute the extraction. See ExtractComponentPlugin to actually perform the extraction.

If you only want to extract a component conditionally, you may use the extract_component_filter attribute.

ยงExample

use bevy_ecs::component::Component;
use bevy_render_macros::ExtractComponent;

#[derive(Component, Clone, ExtractComponent)]
#[extract_component_filter(With<Camera>)]
pub struct Foo {
    pub should_foo: bool,
}

// Without a filter (unconditional).
#[derive(Component, Clone, ExtractComponent)]
pub struct Bar {
    pub should_bar: bool,
}