0

How can I reflect the mode of Timer so that it's visible in the Bevy debug interface - "inspector egui"? Other stats are visible like the current time, a pausing option, etc., just the mode.

Image showing the inspector egui

This is my code:

#[derive(Reflect, Component, Default)]
#[reflect(Component)]
pub struct Tower {
  shooting_timer: Timer
}

In this repo in this file on line 127 this error is defined.

Bruhloon
  • 110
  • 7

1 Answers1

1

This should "just work" now. I tested with bevy_inspector_egui version 0.17.0.

World inspector window showing timer's fields properly displayed

Here's the code I used to test it and produce that image:

use bevy::prelude::*;
use bevy_inspector_egui::quick::WorldInspectorPlugin;

#[derive(Reflect, Component, Default)]
#[reflect(Component)]
struct Tower {
    shooting_timer: Timer,
}

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugin(WorldInspectorPlugin)
        .register_type::<Tower>()
        .add_startup_system(setup)
        .run()
}

fn setup(mut commands: Commands) {
    commands.spawn(Tower::default());
}

Paul Hansen
  • 1,167
  • 1
  • 10
  • 23