diff --git a/crates/bevy_state/src/state_scoped.rs b/crates/bevy_state/src/state_scoped.rs index 9abd22e78e..5f1b2d0be3 100644 --- a/crates/bevy_state/src/state_scoped.rs +++ b/crates/bevy_state/src/state_scoped.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "bevy_reflect")] +use bevy_ecs::reflect::ReflectComponent; use bevy_ecs::{ component::Component, entity::Entity, @@ -6,6 +8,8 @@ use bevy_ecs::{ }; #[cfg(feature = "bevy_hierarchy")] use bevy_hierarchy::DespawnRecursiveExt; +#[cfg(feature = "bevy_reflect")] +use bevy_reflect::prelude::*; use crate::state::{StateTransitionEvent, States}; @@ -52,7 +56,8 @@ use crate::state::{StateTransitionEvent, States}; /// app.enable_state_scoped_entities::(); /// app.add_systems(OnEnter(GameState::InGame), spawn_player); /// ``` -#[derive(Component)] +#[derive(Component, Clone)] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Component))] pub struct StateScoped(pub S); /// Removes entities marked with [`StateScoped`]