Features
- Direct World Access
World
is now a mutable thread local using scoped_tls_hkt
, this mean all (non-watch) access are now immediate and not deferred. Because of this default_settings
now only runs once per frame on update. This makes bevy_defer
significantly more consistent but less parallelizable with other systems. Use bevy_tasks
if blocking/cpu intensive operations are needed.
Before:
entity.component<Transform>().set(|x| x.translation = v).await?
After:
entity.component<Transform>().set(|x| x.translation = v)?
- Derive
AsyncComponent
andAsyncResource
.
Traits for extension methods can now be derived.
- Attribute macro
async_access
.
A macro that mirrors methods with 'static
results to async accessors.
#[async_access]
impl MyTransform {
fn get_translation(&self) -> Vec3 { ... }
}
async_entity.component::<MyTransform>().get_translation()?
BeforeAsyncExecutor
schedule
We now have a dedicated schedule to run reactors in.
Extension methods react_to_*
exist on App
to add these reactors to Event
, State
and Component
change.
In addition, react_to_scene_load
, react_to_animation
and react_to_ui
are automatically added with their features enabled.
- Better Error Handling
Added a mini anyhow::Error
called CustomError
that works nicely with the standard AccessError
and bevy_log
.
Deprecations
-
world()
has been replaced byAsyncWorld
. Most top level methods likespawn()
are deprecated and moved toAsyncWorld
. This can help prevent confusing errors if you have dependencies likesmol
ortokio
with their ownspawn
s. -
AsyncFailure
has been replace byAccessError
andCustomError
. -
bevy_mod_picking
support now lives in a separate crate. -
The ability to create thread locals have been removed, since the world is now mutably accessible.