Cloning into and clone and spawn methods don't cover the same areas
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
Currently when trying to clone components into an existing entity the methods available are
```rust
commands.entity(entity)
.clone_components::(other_entity)
.clone_with_opt_in(other_entity, |_| {})
.clone_with_opt_out(other_entity, |_| {});
```
However when trying to clone components into a new entity the methods available are
```rust
commands.entity(entity)
.clone_and_spawn()
.clone_and_spawn_with_opt_in(|_| {})
.clone_and_spawn_with_opt_out(|_| {});
```
Cloning components into an already existing is missing an equivalent to `clone_and_spawn`, and spawning a new entity and cloning components into it is missing an equivalent to `clone_components`.
## What solution would you like?
Change `clone_components` to clone all components and add a `clone_bundle` that only clones the components in the bundle.
Add a `clone_bundle_and_spawn` method for spawning an entity with the cloned components in the bundle.
## What alternative(s) have you considered?
Use the already existing `clone_(and_spawn)_with_opt_*` methods to cover the missing space, however these methods are quite low level and may be confusing for newcomers
Contributor guide
Research direction
Start by reading the existing clone_components, clone_and_spawn, and clone_(and_spawn)_with_opt_* APIs in the commands entity interface. Compare which components each method copies and how the opt-in and opt-out variants are exposed. Done means the API covers both existing-entity and new-entity cloning for all components and bundle-selected components, with behavior validated against the existing cloning expectations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100