diff --git a/crates/bevy_app/src/app.rs b/crates/bevy_app/src/app.rs index 955f55ed3c35d7..150b4caffec13a 100644 --- a/crates/bevy_app/src/app.rs +++ b/crates/bevy_app/src/app.rs @@ -633,11 +633,13 @@ impl App { self } - /// Initialize a resource with default values by adding it to the [`World`] + /// Initialize a resource with standard starting values by adding it to the [`World`] /// /// If the resource already exists, nothing happens. /// - /// The resource must implement either the `Default` or [`FromWorld`] trait. + /// The resource must implement the [`FromWorld`] trait. + /// If the `Default` trait is implemented, the `FromWorld` trait will use + /// the `Default::default` method to initialize the resource. /// /// ## Example /// ``` @@ -663,11 +665,11 @@ impl App { self } - /// Initialize a non-send resource with default values by adding it to the [`World`] + /// Initialize a non-send resource with standard starting values by adding it to the [`World`] /// - /// If the resource already exists, nothing happens. - /// - /// The resource must implement either the `Default` or [`FromWorld`] trait. + /// The resource must implement the [`FromWorld`] trait. + /// If the `Default` trait is implemented, the `FromWorld` trait will use + /// the `Default::default` method to initialize the resource. pub fn init_non_send_resource(&mut self) -> &mut Self { self.world.init_non_send_resource::(); self diff --git a/crates/bevy_ecs/src/system/commands/mod.rs b/crates/bevy_ecs/src/system/commands/mod.rs index 67b8cc6aa44652..b115d9b32047ae 100644 --- a/crates/bevy_ecs/src/system/commands/mod.rs +++ b/crates/bevy_ecs/src/system/commands/mod.rs @@ -260,7 +260,7 @@ impl<'w, 's> Commands<'w, 's> { self.queue.push(InsertOrSpawnBatch { bundles_iter }); } - /// Inserts a resource with default values to the [`World`]. + /// Inserts a resource with standard starting values to the [`World`]. /// /// If the resource already exists, nothing happens. /// diff --git a/crates/bevy_ecs/src/world/mod.rs b/crates/bevy_ecs/src/world/mod.rs index c364552a2bd484..94421412fd44aa 100644 --- a/crates/bevy_ecs/src/world/mod.rs +++ b/crates/bevy_ecs/src/world/mod.rs @@ -591,12 +591,13 @@ impl World { } } - /// Inserts a new resource with default values. + /// Inserts a new resource with standard starting values. /// /// If the resource already exists, nothing happens. /// - /// Uses the [`FromWorld`] trait to determine values, - /// which has a blanket impl for all `R: Default`. + /// The value given by the [`FromWorld::from_world`] method will be used. + /// Note that any resource with the `Default` trait automatically implements `FromWorld`, + /// and those default values will be here instead. #[inline] pub fn init_resource(&mut self) { // PERF: We could avoid double hashing here, since the `from_resources` call is guaranteed @@ -620,12 +621,13 @@ impl World { unsafe { self.insert_resource_with_id(component_id, value) }; } - /// Inserts a new non-send resource with default values. + /// Inserts a new non-send resource with standard starting values. /// /// If the resource already exists, nothing happens. /// - /// Uses the [`FromWorld`] trait to determine values, - /// which has a blanket impl for all `R: Default`. + /// The value given by the [`FromWorld::from_world`] method will be used. + /// Note that any resource with the `Default` trait automatically implements `FromWorld`, + /// and those default values will be here instead. #[inline] pub fn init_non_send_resource(&mut self) { // PERF: We could avoid double hashing here, since the `from_resources` call is guaranteed