diff --git a/crates/bevy_core/src/name.rs b/crates/bevy_core/src/name.rs index 1f6f40c7cec42..dfa4a11c118bd 100644 --- a/crates/bevy_core/src/name.rs +++ b/crates/bevy_core/src/name.rs @@ -10,6 +10,9 @@ use std::{ ops::Deref, }; +#[cfg(feature = "serialize")] +use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; + /// Component used to identify an entity. Stores a hash for faster comparisons. /// /// The hash is eagerly re-computed upon each update to the name. @@ -19,8 +22,9 @@ use std::{ /// used instead as the default unique identifier. #[derive(Reflect, Component, Clone)] #[reflect(Component, Default, Debug)] +#[cfg_attr(feature = "serialize", reflect(Serialize, Deserialize))] pub struct Name { - hash: u64, // TODO: Shouldn't be serialized + hash: u64, // Won't be serialized (see: `bevy_core::serde` module) name: Cow<'static, str>, }