Closed blueforesticarus closed 9 months ago
You're missing app.register_type::<Speed>()
. Also I think the inspector only shows types that have #[reflect(Resource)]
below the derive but I'm not 100% sure right now.
Yup. Needed both of those. Gracias
Working:
use bevy::prelude::*;
use bevy_editor_pls::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(EditorPlugin::default())
.add_systems(Startup, setup)
.add_systems(Update, keyboard_input_system)
//.init_resource::<Speed>()
.insert_resource(Speed { s: 0.5 })
.register_type::<Speed>() //HERE
.run();
}
#[derive(Resource, Reflect)]
#[reflect(Resource)] //HERE
pub struct Speed {
pub s: f32,
}
semi-relevant open bevy issue https://github.com/bevyengine/bevy/issues/3936
Also I think bevy_inspector_egui
could technically display all registered resources, regardless of whether they have reflect(Resource)
. I'm not sure if that would be better, maybe it's good to be explicit about that, and I think things like resources in scenes need it.
I can't seem to figure out how to get my custom resource to show up in the panel. I've tried deriving Reflect based on reading the resource panel code, but to no avail.
What I have:
But
Speed
still does not show up in the resource panel.