Skip to content

Add initial release notes for commands + exclusive world access #1209

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
TODO
Working with `Commands` when you have exclusive world access has always been a pain.
Create a `CommandQueue`, generate a `Commands` out of that, send your commands and then apply it?
Not exactly the most intuitive solution.

Now, you can access the `World`'s own command queue:

```rust
let mut world = World::new();
let mut commands = world.commands();
commands.spawn(TestComponent);
world.flush_commands();
```

While this isn't the most performant approach (just apply the mutations directly to the world and skip the indirection),
this API can be great for quickly prototyping with or easily testing your custom commands (and is used internally to power lifecycle hooks).

As a bonus, one-shot systems now apply their commands (and other deferred system params) immediately when run!
We already have exclusive world access: why introduce delays and subtle bugs?
4 changes: 2 additions & 2 deletions release-content/0.14/release-notes/_release-notes.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ url = "https://github.com/bevyengine/bevy/pull/12013"
file_name = "12013_Upstreaming_bevy_color.md"

[[release_notes]]
title = "Immediately apply deferred system params in System::run"
authors = ["@james7132","@alice-i-cecile"]
title = "`Commands` and exclusive world access: working together in harmony"
authors = ["@james7132", "@james-j-obrien"]
url = "https://github.com/bevyengine/bevy/pull/11823"
file_name = "11823_Immediately_apply_deferred_system_params_in_Systemrun.md"

Expand Down