bevy/crates/bevy_hierarchy/src
JaySpruce db4c468fe2
Rename EntityCommands::clone to clone_and_spawn (#16696)
## Objective

Follow-up to #16672.

`EntityCommands::clone` looks the same as the `Clone` trait, which could
be confusing. A discord discussion has made me realize that's probably a
bigger problem than I thought. Oops :P

## Solution

Renamed `EntityCommands::clone` to `EntityCommands::clone_and_spawn`,
renamed `EntityCommands::clone_with` to
`EntityCommands::clone_and_spawn_with`. Also added some docs explaining
the commands' relation to `Clone` (components need to implement it (or
`Reflect`)).

## Showcase

```
// Create a new entity and keep its EntityCommands
let mut entity = commands.spawn((ComponentA(10), ComponentB(20)));

// Create a clone of the first entity
let mut entity_clone = entity.clone_and_spawn();
```

## The Bikeshed

- `clone_and_spawn` (Alice's suggestion)
- `spawn_clone` (benfrankel's suggestion)
- `spawn_cloned` (rparrett's suggestion)
2024-12-10 03:26:15 +00:00
..
components Window picking (#16103) 2024-12-05 21:14:39 +00:00
child_builder.rs Improve child_builder add_child documentation slightly (#16663) 2024-12-10 03:15:52 +00:00
events.rs Fix bevy_hierarchy failing to compile without reflect feature (#16428) 2024-11-19 01:28:42 +00:00
hierarchy.rs Rename EntityCommands::clone to clone_and_spawn (#16696) 2024-12-10 03:26:15 +00:00
lib.rs Fix permissions of rust source files (#16310) 2024-11-09 16:34:38 +00:00
query_extension.rs Migrate from Query::single and friends to Single (#15872) 2024-10-13 20:32:06 +00:00
valid_parent_check_plugin.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00