We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5c0023c commit fbfd8beCopy full SHA for fbfd8be
crates/bevy_ecs/src/component/mod.rs
@@ -16,6 +16,13 @@ use thiserror::Error;
16
///
17
/// Any type that is `Send + Sync + 'static` can implement `Component` using `#[derive(Component)]`.
18
19
+/// In order to use foreign types as components, wrap them using a newtype pattern.
20
+/// ```
21
+/// # use bevy_ecs::component::Component;
22
+/// use std::time::Duration;
23
+/// #[derive(Component)]
24
+/// struct Cooldown(Duration);
25
26
/// Components are added with new entities using [`Commands::spawn`](crate::system::Commands::spawn),
27
/// or to existing entities with [`EntityCommands::insert`](crate::system::EntityCommands::insert),
28
/// or their [`World`](crate::world::World) equivalents.
0 commit comments