-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename EntityCommands::clone
to clone_and_spawn
#16696
Conversation
Here's a link to the referenced conversation. https://discord.com/channels/691052431525675048/749335865876021248/1314635145650638960 (btw, can't wait to use this feature) |
Credit to @eugineerd for the neat feature, sorry for repeatedly nitpicking it :P |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I definitely think we should rename this, but I find spawn_clone
quite awkward and unclear. Are you okay with clone_and_spawn
instead?
What about Also cc @benfrankel who originally suggested |
That's also an improvement, but I think that the order of operations (clone the data out, then spawn a new entity with it) is clearest with my suggestion :) |
EntityCommands::clone
to spawn_clone
EntityCommands::clone
to clone_and_spawn
## Objective Follow-up to bevyengine#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)
Objective
Follow-up to #16672.
EntityCommands::clone
looks the same as theClone
trait, which could be confusing. A discord discussion has made me realize that's probably a bigger problem than I thought. Oops :PSolution
Renamed
EntityCommands::clone
toEntityCommands::clone_and_spawn
, renamedEntityCommands::clone_with
toEntityCommands::clone_and_spawn_with
. Also added some docs explaining the commands' relation toClone
(components need to implement it (orReflect
)).Showcase
The Bikeshed
clone_and_spawn
(Alice's suggestion)spawn_clone
(benfrankel's suggestion)spawn_cloned
(rparrett's suggestion)