diff --git a/crates/bevy_a11y/Cargo.toml b/crates/bevy_a11y/Cargo.toml index c20b781bbd..62cf5ef240 100644 --- a/crates/bevy_a11y/Cargo.toml +++ b/crates/bevy_a11y/Cargo.toml @@ -13,6 +13,7 @@ keywords = ["bevy", "accessibility", "a11y"] bevy_app = { path = "../bevy_app", version = "0.15.0-dev" } bevy_derive = { path = "../bevy_derive", version = "0.15.0-dev" } bevy_ecs = { path = "../bevy_ecs", version = "0.15.0-dev" } +bevy_reflect = { path = "../bevy_reflect", version = "0.15.0-dev" } accesskit = "0.16" diff --git a/crates/bevy_a11y/src/lib.rs b/crates/bevy_a11y/src/lib.rs index cdc653b0d2..92f514ab45 100644 --- a/crates/bevy_a11y/src/lib.rs +++ b/crates/bevy_a11y/src/lib.rs @@ -17,10 +17,11 @@ use accesskit::NodeBuilder; use bevy_app::Plugin; use bevy_derive::{Deref, DerefMut}; use bevy_ecs::{ - prelude::{Component, Entity, Event}, + prelude::{Component, Entity, Event, ReflectResource}, schedule::SystemSet, system::Resource, }; +use bevy_reflect::Reflect; /// Wrapper struct for [`accesskit::ActionRequest`]. Required to allow it to be used as an `Event`. #[derive(Event, Deref, DerefMut)] @@ -92,7 +93,8 @@ impl From for AccessibilityNode { } /// Resource representing which entity has keyboard focus, if any. -#[derive(Resource, Default, Deref, DerefMut)] +#[derive(Resource, Default, Deref, DerefMut, Reflect)] +#[reflect(Resource)] pub struct Focus(pub Option); /// Set enum for the systems relating to accessibility @@ -108,6 +110,8 @@ pub struct AccessibilityPlugin; impl Plugin for AccessibilityPlugin { fn build(&self, app: &mut bevy_app::App) { + app.register_type::(); + app.init_resource::() .init_resource::() .init_resource::()