jakobhellermann / bevy-inspector-egui

Inspector plugin for the bevy game engine
Apache License 2.0
1.19k stars 173 forks source link

Inspectable with vec of generic type #29

Closed AnotherCoolDude closed 3 years ago

AnotherCoolDude commented 3 years ago

Hey,

thanks for the awesome crate!

Maybe you can help me with an issue I ran into: I have a resource Table which I want to inspect at runtime:

#[derive(Inspectable)]
pub struct Table<T: Copy + Debug + Clone> {
    pub radius: Distance, 
    pub size: Distance,
    pub tiles: Vec<T>, 
}

T can be different types of Tiles, therefore it's generic.

It keeps telling me struct defined here, with 1 type parameter: "T"

Is there a way to make the struct inspectable?

jakobhellermann commented 3 years ago

It should be fixed now with https://github.com/jakobhellermann/bevy-inspector-egui/commit/181d941abc79cbb458ef1e7b73bdd337733b1b5a, can you try if it works now for you?

You can depend on the git version using

bevy-inspector-egui = { git = "https://github.com/jakobhellermann/bevy-inspector-egui", branch = "main" }
AnotherCoolDude commented 3 years ago

Awesome, works like a charm. Thank you very much 👍