Cannot build a runtime observer system using a closure #19284
Labels
A-ECS
Entities, components, systems, and events
C-Bug
An unexpected or incorrect behavior
D-Modest
A "normal" level of difficulty; suitable for simple features or challenging fixes
S-Needs-Investigation
This issue requires detective work to figure out what's going wrong
Bevy version
0.16
What you did
I'm attempting to create an observer system at runtime that needs to query components created at runtime.
What went wrong
When calling
build_system_with_input
with a closure, I get the following error:help: the trait `bevy::prelude::SystemParamFunction<_>` is not implemented for closure
However, if this is broken out into a free function with the same signature and called that way, it works fine:
It is not necessary to have the
Query
to reproduce the issue, but I included it for a more accurate view of what I was attempting to accomplish. This still fails:Additional information
This only seems to apply to observer systems; creating non-observer systems with a closure using
build_system
orbuild_system_with_input
seems to work perfectly fine.I was hoping to capture a couple of variables in the closure for use in the system, but this limitation means I have to store those extra variables in a resource and do a lookup each time it's triggered. I'm unsure what specifically is causing this issue, as the various generic bounds and impls are difficult to understand from an outsider perspective
The text was updated successfully, but these errors were encountered: