We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent df20dd5 commit 7d2348cCopy full SHA for 7d2348c
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