mirror of
https://github.com/bevyengine/bevy
synced 2024-12-19 09:33:06 +00:00
db4c468fe2
## 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) |
||
---|---|---|
.. | ||
components | ||
child_builder.rs | ||
events.rs | ||
hierarchy.rs | ||
lib.rs | ||
query_extension.rs | ||
valid_parent_check_plugin.rs |