Open
Conversation
dlom
commented
Apr 18, 2026
| assert_eq!(vec!["event_a"], world.resource::<Order>().0); | ||
| } | ||
|
|
||
| /// Collects `u32` values read by dynamic observers through `PtrMut`. |
Author
There was a problem hiding this comment.
The next 250 lines are all the new tests
Adds three new unsafe `World` functions: - `trigger_dynamic()` - `trigger_dynamic_targets()` - `trigger_dynamic_targets_components()` These enable observers to be triggered with untyped events and trigger data. Their implementations are just wiring up some existing internal structure. Structurally, they are based on their non-dynamic counterparts. Also exposes `EventKey::new()` and `EventKey::component_id()` for constructing event keys from dynamic `ComponentId`s. Extends the dynamic example with event registration and triggering.
23efde4 to
38cb1d4
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Finish the bevy_ecs dynamic story. Currently you can register observers with dynamic triggers and runners, but there's no way to actually trigger these observers dynamically.
Solution
Adds three new unsafe
Worldfunctions:trigger_dynamic()trigger_dynamic_targets()trigger_dynamic_targets_components()These enable observers to be triggered with untyped events and trigger data. Their implementations are just wiring up some existing internal structure. Structurally, they are based on their non-dynamic counterparts.
Also exposes
EventKey::new()andEventKey::component_id()for constructing event keys from dynamicComponentIds.Testing
Several new tests
Showcase
See updated example