Skip to content

Fix Gizmos not drawing On<Pointer<Drag>>, Observers generally, and Triggered Systems#22800

Open
kfc35 wants to merge 1 commit intobevyengine:mainfrom
kfc35:22485_observer_gizmos
Open

Fix Gizmos not drawing On<Pointer<Drag>>, Observers generally, and Triggered Systems#22800
kfc35 wants to merge 1 commit intobevyengine:mainfrom
kfc35:22485_observer_gizmos

Conversation

@kfc35
Copy link
Contributor

@kfc35 kfc35 commented Feb 4, 2026

Objective

Solution

  • Implement queue() for both the Gizmos SystemParam and the GizmoBuffer SystemBuffer. Its body is the same as apply() except it acts on DeferredWorld.
  • After much debugging, I discovered that the Gizmos system parameter never had apply() called on it when it was being used within an observer, which was why its internal SystemBuffer (GizmoBuffer) kept growing indefinitely. I saw that SystemParam’s also have a queue() function and was curious whether that was being called instead… and it was! So, I just implemented queue() in the same way that apply() was (after making sure it was OK to use a DeferredWorld in that way… and seems like it is OK?), and it solves the issue.
  • Edit: I guess this problem has been described before in Deferred doesn't seem to work with observers #14597 , where the solution described there as well is to implement apply()
  • Disclaimer: Not an ECS master, so someone with ECS mastery can make sure what I wrote makes sense.

Testing

The reproduction example in #22485 works now. A white square gizmo is drawn in the center if you drag inside the window.
I also tested against the examples in #14566 (both of them) and #19119 and the missing gizmos are drawn.

@kfc35 kfc35 force-pushed the 22485_observer_gizmos branch from 84e5413 to 858c8d6 Compare February 4, 2026 02:42

#[expect(
unused_mut,
reason = "The `world` parameter is unused for zero-length tuples; however, it must be mutable for other lengths of tuples."
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied this from the macro rule for impl_system_param_tuple since it was complaining here too

@kfc35 kfc35 added C-Bug An unexpected or incorrect behavior A-ECS Entities, components, systems, and events A-Gizmos Visual editor and debug gizmos D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Feb 4, 2026
@kfc35 kfc35 changed the title Fix Gizmos not drawing in On<Pointer<Drag>> (maybe Observers in general?) Fix Gizmos not drawing On<Pointer<Drag>> (maybe Observers in general?) Feb 4, 2026
@alice-i-cecile alice-i-cecile added this to the 0.18.1 milestone Feb 4, 2026
@kfc35 kfc35 changed the title Fix Gizmos not drawing On<Pointer<Drag>> (maybe Observers in general?) Fix Gizmos not drawing On<Pointer<Drag>>, Observers generally, and Triggered Systems) Feb 5, 2026
@kfc35 kfc35 changed the title Fix Gizmos not drawing On<Pointer<Drag>>, Observers generally, and Triggered Systems) Fix Gizmos not drawing On<Pointer<Drag>>, Observers generally, and Triggered Systems Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events A-Gizmos Visual editor and debug gizmos C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pointer<Drag> observers do not render gizmos Gizmos will not render from a registered system Gizmos do not show from a triggered system

2 participants