Document EntityCommands/EntityMut insert() (#6270)

Fixes #6258.
This commit is contained in:
JMS55 2022-10-17 14:38:58 +00:00
parent bfbcd47725
commit 708535536b
2 changed files with 6 additions and 1 deletions

View file

@ -321,7 +321,7 @@ impl<'w, 's> Commands<'w, 's> {
/// if let Some(mut entity_commands) = commands.get_entity(entity) {
/// // adds a single component to the entity
/// entity_commands.insert(Label("hello world"));
/// }
/// }
/// }
/// # bevy_ecs::system::assert_is_system(example_system);
/// ```
@ -565,6 +565,8 @@ impl<'w, 's, 'a> EntityCommands<'w, 's, 'a> {
/// Adds a [`Bundle`] of components to the entity.
///
/// This will overwrite any previous value(s) of the same component type.
///
/// # Panics
///
/// The command will panic when applied if the associated entity does not exist.

View file

@ -246,6 +246,9 @@ impl<'w> EntityMut<'w> {
self.insert(bundle)
}
/// Adds a [`Bundle`] of components to the entity.
///
/// This will overwrite any previous value(s) of the same component type.
pub fn insert<T: Bundle>(&mut self, bundle: T) -> &mut Self {
let change_tick = self.world.change_tick();
let bundle_info = self