Skip to content

Commit 7085355

Browse files
committed
Document EntityCommands/EntityMut insert() (#6270)
Fixes #6258.
1 parent bfbcd47 commit 7085355

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

crates/bevy_ecs/src/system/commands/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ impl<'w, 's> Commands<'w, 's> {
321321
/// if let Some(mut entity_commands) = commands.get_entity(entity) {
322322
/// // adds a single component to the entity
323323
/// entity_commands.insert(Label("hello world"));
324-
/// }
324+
/// }
325325
/// }
326326
/// # bevy_ecs::system::assert_is_system(example_system);
327327
/// ```
@@ -565,6 +565,8 @@ impl<'w, 's, 'a> EntityCommands<'w, 's, 'a> {
565565

566566
/// Adds a [`Bundle`] of components to the entity.
567567
///
568+
/// This will overwrite any previous value(s) of the same component type.
569+
///
568570
/// # Panics
569571
///
570572
/// The command will panic when applied if the associated entity does not exist.

crates/bevy_ecs/src/world/entity_ref.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ impl<'w> EntityMut<'w> {
246246
self.insert(bundle)
247247
}
248248

249+
/// Adds a [`Bundle`] of components to the entity.
250+
///
251+
/// This will overwrite any previous value(s) of the same component type.
249252
pub fn insert<T: Bundle>(&mut self, bundle: T) -> &mut Self {
250253
let change_tick = self.world.change_tick();
251254
let bundle_info = self

0 commit comments

Comments
 (0)