-
I am attempting to serialize and de-serialize a list of many different types of events (think tracking and playing back input events). Unfortunately I have hit a roadblock with Bevy not liking my data structure for storing events: use bevy::prelude::*;
#[derive(Reflect, Default)]
struct Foo {
things: Vec<Box<dyn Reflect>>,
}
fn main() {
let a = Foo::default().as_reflect();
} This gets the following compiler error with Long compiler output...
I am able to write events to this list just fine using Anybody know what I might be doing wrong? Is this possible in Bevy today? If so what do I need to change about my usage? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Unfortunately not possible today. You could maybe get around it by using We currently need this PR (which I’m planning to rebase), as well as some additional stuff I’m currently working on. I’m hopeful we can get this functionality in 0.17 though so stay tuned! |
Beta Was this translation helpful? Give feedback.
Unfortunately not possible today. You could maybe get around it by using
Arc<dyn Reflect>
, assuming the types all registerReflectSerialize
, but it's still an in-progress feature.We currently need this PR (which I’m planning to rebase), as well as some additional stuff I’m currently working on. I’m hopeful we can get this functionality in 0.17 though so stay tuned!