How to get all components that implement a specific trait #10096
-
I'm making a multiplayer plugin, and for one of the systems, I need to access all of the components that implement this 'Serializable' trait pub trait Serializable {
fn from_bytes(&mut self, bytes: &[u8]);
fn to_bytes(&self) -> Vec<u8>;
fn get_type_id(&self) -> u16;
} How would I go about making a query that gets all components that implement this trait? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You want https://crates.io/crates/bevy-trait-query :) Eventually we may upstream it, but for now it's well-maintained and popular. |
Beta Was this translation helpful? Give feedback.
You want https://crates.io/crates/bevy-trait-query :) Eventually we may upstream it, but for now it's well-maintained and popular.