-
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use `try_insert` to prevent `panic`s When using `insert` instead of `try_insert` on `EntityCommand`, it can happen that the system panics, when the entity does not exist, even when the `EntityCommand` has been accessed with `get_entity(...)`. The following example demonstrates the problem: ```rust if let Some(mut entity_commands) = commands.get_entity(entity) { // at this point some other system despawns `entity` concurrently entity_commands.insert(bundle); // ^^^^^^ this will panic } ``` This is also documented in the official bevy docs: https://docs.rs/bevy/0.12.1/bevy/ecs/system/struct.Commands.html#method.get_entity * replace other uses of insert with try_insert * Update changelog --------- Co-authored-by: Jan Riemer <[email protected]> Co-authored-by: Aevyrie <[email protected]>
- Loading branch information
1 parent
fd08e46
commit b551d21
Showing
4 changed files
with
4 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters