Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

u32 is #[reflect_value], but has no InspectorEguiImpl registered in the TypeRegistry. #217

Open
GabiJunkes opened this issue Sep 29, 2024 · 1 comment

Comments

@GabiJunkes
Copy link

Using bevy_inspector::ui_for_value on version 0.26.0 gives:
u32 is #[reflect_value], but has no InspectorEguiImpl registered in the TypeRegistry . Try calling .register_type::<u32> or add the DefaultInspectorConfigPlugin for builtin types..

Just changing to 0.25.2 fixes the issue.
My code:

use bevy::prelude::*;
use bevy_editor_pls::egui;
use bevy_editor_pls_core::editor_window::{EditorWindow, EditorWindowContext};
use bevy_inspector_egui::bevy_inspector;

use crate::world::world_gen::WorldGenerationData;

pub struct MapGenWindow;

impl EditorWindow for MapGenWindow {
    type State = WindowState;
    const NAME: &'static str = "World Generator";

    fn ui(world: &mut World, mut cx: EditorWindowContext, ui: &mut egui::Ui) {
        world.resource_scope(|world, mut world_data: Mut<WorldGenerationData>| {    
            let Some(state) = cx.state_mut::<MapGenWindow>() else {
                return;
            };
    
            ui.label("Generator:");
            ui.indent("Seed", |ui| {
                ui.horizontal(|ui| {
                    ui.label("Seed:");
                    if bevy_inspector::ui_for_value(&mut state.old_seed, ui, world) {
                        world_data.seed = state.old_seed;
                    }
                })
            });
        })
    }
}

pub struct WindowState {
    old_seed: u32,
}

impl Default for WindowState {
    fn default() -> Self {
        WindowState {
            old_seed: 204,
        }
    }
}

Version 0.26.0:
image

Version 0.25.2:
image

@muhuk
Copy link

muhuk commented Dec 1, 2024

I'm getting the same issue with NonZeroU16 and version 0.25.2.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants