-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Changed<ComputedVisibility> always evaluates as true #8267
Copy link
Copy link
Closed
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior
Description
Bevy version
v0.10.0
What you did
- Implemented a system that relies on accurate change tracking via
Changed<ComputedVisibility>
fn my_visibility_system(changed_visibility: Query<(Entity, &ComputedVisibility), Changed<ComputedVisibility>>) {
for (entity, computed_visibility) in query_changed_visibility.iter() {
info!("Entity {entity:?} visibility changed to {}", computed_visibility.is_visible());
}
}What went wrong
ComputedVisibilityis mutated every frame regardless of whether its underlying flags have actually changed- In the above example, this causes
Entity (foo) visibility changed to (bar)to log each frame, instead of when a self / ancestorVisibilitycomponent is modified, or when an entity'sAabbpasses in / out of the view frustum.
Additional information
This prevents user code from reasoning about changes in ComputedVisibility, necessitating manual per-frame change tracking. This can be achieved by locally caching ComputedVisibility state on a per-entity basis, or checking the state fed into by ComputedVisibility before mutating it, but isn't DRY versus being able to use the built-in machinery.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior