bevy
bevy copied to clipboard
`System::run` should call `System::apply_deferred`
What problem does this solve or what need does it fill?
Since merging #9822, we're now treating deferred mutations the same way as other mutations when possible. We don't want users to have to think about when commands get applied, so we apply them as early as possible in most cases.
What solution would you like?
In the default implementation for System::run
, we should call System::apply_deferred
after calling System::run_unsafe
. We already have access to &mut World
in System::run
, so there is little reason not to do this.
What alternative(s) have you considered?
None
My only concern here is that, if we follow through with this, the SimpleExecutor
and SingleThreadedExecutor
become equivalent, which may lead to developers writing code that relies on the immediate application of commands, which can be fragile when migrated to a mulithreaded environment.
This is potentially mitigated by just using run_unsafe
in the SingleThreadedExecutor though, and it does mean we can probably remove the simple executor, which means less code to maintain.