From 9e80d8664e0dc2f8178293283cc5e816d3e15397 Mon Sep 17 00:00:00 2001 From: Sludge <96552222+SludgePhD@users.noreply.github.com> Date: Fri, 10 Nov 2023 00:34:45 +0100 Subject: [PATCH 1/2] `#[derive(Reflect)]` on `GizmoConfig` --- crates/bevy_gizmos/src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/bevy_gizmos/src/lib.rs b/crates/bevy_gizmos/src/lib.rs index 446605b43e4f8..e18b8fe935a71 100644 --- a/crates/bevy_gizmos/src/lib.rs +++ b/crates/bevy_gizmos/src/lib.rs @@ -77,7 +77,9 @@ impl Plugin for GizmoPlugin { fn build(&self, app: &mut bevy_app::App) { load_internal_asset!(app, LINE_SHADER_HANDLE, "lines.wgsl", Shader::from_wgsl); - app.add_plugins(UniformComponentPlugin::::default()) + app.register_type::() + .register_type::() + .add_plugins(UniformComponentPlugin::::default()) .init_asset::() .add_plugins(RenderAssetPlugin::::default()) .init_resource::() @@ -135,7 +137,7 @@ impl Plugin for GizmoPlugin { } /// A [`Resource`] that stores configuration for gizmos. -#[derive(Resource, Clone)] +#[derive(Resource, Clone, Reflect)] pub struct GizmoConfig { /// Set to `false` to stop drawing gizmos. /// @@ -188,7 +190,7 @@ impl Default for GizmoConfig { } /// Configuration for drawing the [`Aabb`] component on entities. -#[derive(Clone, Default)] +#[derive(Clone, Default, Reflect)] pub struct AabbGizmoConfig { /// Draws all bounding boxes in the scene when set to `true`. /// From 9bf77f2466862ad830343e5bf26e1a051ae7d27a Mon Sep 17 00:00:00 2001 From: Sludge <96552222+SludgePhD@users.noreply.github.com> Date: Fri, 10 Nov 2023 21:13:42 +0100 Subject: [PATCH 2/2] Reflect `Resource` behavior --- crates/bevy_gizmos/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/bevy_gizmos/src/lib.rs b/crates/bevy_gizmos/src/lib.rs index e18b8fe935a71..333d8e2e9bbc7 100644 --- a/crates/bevy_gizmos/src/lib.rs +++ b/crates/bevy_gizmos/src/lib.rs @@ -37,7 +37,7 @@ use bevy_ecs::{ component::Component, entity::Entity, query::{ROQueryItem, Without}, - reflect::ReflectComponent, + reflect::{ReflectComponent, ReflectResource}, schedule::IntoSystemConfigs, system::{ lifetimeless::{Read, SRes}, @@ -138,6 +138,7 @@ impl Plugin for GizmoPlugin { /// A [`Resource`] that stores configuration for gizmos. #[derive(Resource, Clone, Reflect)] +#[reflect(Resource)] pub struct GizmoConfig { /// Set to `false` to stop drawing gizmos. ///