-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Revert "Have EntityCommands methods consume self for easier chaining" #15523
base: main
Are you sure you want to change the base?
Conversation
@@ -1405,8 +1407,8 @@ impl EntityCommands<'_> { | |||
/// # bevy_ecs::system::assert_is_system(remove_character_system); | |||
/// ``` | |||
#[track_caller] | |||
pub fn despawn(self) -> Self { |
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.
#14897 mistakenly made despawn
return self
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.
For context, this wasn't a mistake, it was something acknowledged in the PR: #14897 (comment)
.with_scale(Vec3::new(1.0, 1.0, 0.5)), | ||
..default() | ||
.insert_if(CameraTracked, || i == 0) | ||
.with_children(|parent| { |
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.
Only indentation/whitespace changes below this comment in this file :)
gits diffs do a surprisingly bad job with indentation changes
Could you provide details as to why this revert should be merged in your PR description? |
self.spawn_empty().insert(bundle) | ||
let mut entity = self.spawn_empty(); | ||
entity.insert(bundle); | ||
entity |
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.
IMO the only clear win for consuming self
, but that's because the spawn methods return EntityCommands
by value either way
Apologies, I forgot to link to the relevant issue. Added to the PR description. |
I'm hoping the issue in question gets a little more time to discuss before this goes through. |
Yep, I intend to leave this discussion open in the linked issue until the release candidate is due to be cut. Given the level of controversy and breakage, I don't think it should have been merged without more discussion, so the default stance here is "revert". |
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 compared the diff to the one from #14897, and this does revert the &mut self
to self
changes while preserving the insert_if
changes. (The changes to EntityEntryCommands
aren't exactly a revert, but seem to be in the same spirit.)
pub fn and_modify(mut self, modify: impl FnOnce(Mut<T>) + Send + Sync + 'static) -> Self { | ||
self.entity_commands = self | ||
.entity_commands | ||
pub fn and_modify(&mut self, modify: impl FnOnce(Mut<T>) + Send + Sync + 'static) -> &mut Self { |
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 think this makes sense, but I want to highlight that the changes to EntityEntryCommands
aren't exactly a revert. This type didn't exist at the time of the original change, and it could make sense for it to work differently from EntityCommands
.
@tim-blackbird I'll merge this once you resolve the merge conflicts :) |
As discussed in #15521
self
insert_if
method is keptThe migration guide of #14897 should be removed
Closes #15521