bevy/crates/bevy_hierarchy
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
..
src Rename EntityCommands::clone to clone_and_spawn (#16696) 2024-12-10 03:26:15 +00:00
Cargo.toml Use crate: disqualified (#15372) 2024-09-23 17:34:17 +00:00
README.md Add README.md to all crates (#13184) 2024-05-02 18:56:00 +00:00

Bevy Hierarchy

License Crates.io Downloads Docs Discord