-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Fixes #18740, added the missing documentation for B parameter on Trigger. #18914
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
Conversation
/// See [Trigger::propagate] for more information. It also provides a [Bundle] type representing a set of | ||
/// components associated with the triggered event. This would be useful to access the components or data | ||
/// that are related to the event. |
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.
Part of the confusion I was having with the B
parameter is that it doesn't seem to filter its contained components by default. Instead, I believe there is some extra step needed when defining the observer such that it can actually be used. I think pointing users to that method(s) and explaining how to use it could be a bit more useful.
/// See [Trigger::propagate] for more information. It also provides a [Bundle] type representing a set of | ||
/// components associated with the triggered event. This would be useful to access the components or data | ||
/// that are related to the event. |
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.
We should probably also mention how this bundle parameter will filter out entities that don't contain all components in the bundle (it could be the other way around, I forget haha)
/// A type that encapsulates information about a triggered [Event] during a specific [Observer] run. It includes | ||
/// the [Event] data, the corresponding [Entity] that triggered it, and details about event propagation. |
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.
Two minor nitpicks:
- The links should probably continue to use the backticks to indicate to the user that these are in fact traits/types
- Normally we recommend an empty line after the first sentence/summary
# Objective The documentation for observers is not very good. This poses a problem to users, but *also* causes serious problems for engine devs, as they attempt to improve assorted issues surrounding observers. This PR: - Fixes #14084. - Fixes #14726. - Fixes #16538. - Closes #18914, by attempting to solve the same issue. To keep this PR at all reviewable, I've opted to simply note the various limitations (some may call them bugs!) in place, rather than attempting to fix them. There is a huge amount of cleanup work to be done here: see https://github.com/orgs/bevyengine/projects/17. ## Solution - Write good module docs for observers, offering bread crumbs to the most common methods and techniques and comparing-and-contrasting as needed. - Fix any actively misleading documentation. - Try to explain how the various bits of the (public?!) internals are related. --------- Co-authored-by: Chris Biscardi <chris@christopherbiscardi.com> Co-authored-by: Joona Aalto <jondolf.dev@gmail.com>
Objective
B
parameter onTrigger
#18740Solution
Testing