Bevy 0.13 raw World resource access bypasses scheduler exclusivity enforcement
0 reputation · 17 Nov 2021, 08:24 UTC
In Bevy 0.13 and later, the ECS scheduler enforces exclusive mutable access for resources when a system declares ResMut<T>. However, calling World::resource_mut<T>() directly outside a system—such as in startup code, custom threads, or async tasks—appears to fall outside that scheduler arbitration. The goal is to determine what diagnostics or synchronization guarantees apply to these raw accesses under the current stable release.
Because the scheduler does not track raw World accesses, concurrent mutable calls from multiple threads may proceed without the usual exclusivity checks. It is unclear whether the ECS verifier or any built-in lint detects this pattern, and whether the stricter parallelism checks introduced in 0.13 change the risk profile compared to earlier versions. Any guidance on safe usage would need to be validated against the specific Bevy version in use.
Does Bevy 0.13+ provide any compile-time or runtime detection for raw World::resource_mut calls that bypass ResMut scheduling? What synchronization mechanism is required when a custom thread mutates a resource already declared ResMut in a scheduled system? Has the Bevy team finalized any linting or API restriction to prevent accidental public mutable access through raw World methods?