Releases: mintlu8/bevy_defer
0.11.0
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.
Release v0.9.0
What's New
- Replaced
futures_executor
withasync_executor
This is the same executor as bevy_tasks
, which would fit nicely in the bevy ecosystem. The AsyncExecutor
can now be cloned to spawn futures. Additionally, the dependency on futures
has been minimized to not include the macros.
- Id for
AsyncSystem
You can now add an id
to an AsyncSystem
to allow targeted removal from the AsyncSystems
component.
- The
AsyncAccess
trait.
Methods like get
, set
, watch
etc are now provided by the AsyncAccess
trait. This makes access methods in this crate more consistent. get
for example will never wait for something to be loaded. get_on_load
can now be used instead to wait for an item to be loaded before accessing it.
AsyncQuerySingle
Added a specialized accessor for the single()
query.
- Stream support
Signal
is now a Stream
, API regarding States
and Event
are now stream based.
- Reactors
Add systems react_to_*
to react to changes in the world.
react_to_state
allows you to react to state change asynchronouslyreact_to_event
allows you to subscribe to events asynchronously
Breaking Changes
-
get
,cloned
onAsyncAsset
no longer waits for the asset to be loaded, use the*_on_load
methods instead. -
The old
AsyncEvent
is scrapped and replaced withEventStream
. -
Renames
extension
is moved toaccess::deref
picking
is moved toext::picking
Release v0.8.0
What's Changed
- Better plugin modularity.
We can now add schedule and system sets via the new AsyncPlugin
.
- Non-Send internals
Most of this crate now runs on Rc
and RefCell
, this means we can drop some lifetimes around
not cloning Arc
s, you would find chaining methods much easier!
-
Thread locals!
-
We can push
&World
,Resource
andNonSend
to thread local storage, enabling more non-deferred access. -
AssetServer
,NamedSignals
,CommandQueue
are accessible via thread locals by default. -
With the optional
&World
thread local access, allget
access are immediate, at the cost of some parallelization.
-
-
AsyncEventReader
,AsyncAsset
and better named signal support-
AsyncEventReader
is now a persistent event reader that behaves properly. -
AsyncAsset
, or ratherHandle
can be accessed byAssetPath
without deferring. -
NamedSignals
can be accessed by name without deferring.
-
-
apply_command
andapply_command_queue
apply_command
uses a thread local CommandQueue
and is no longer async.
- Tweening
We can run cancellable and awaitable tweening functions on FixedUpdate
.
bevy_mod_picking
integration
We now have a reactor for bevy_mod_picking
.
Signals
rewrite
Signals
is no longer type erased, therefore Object
is no longer a part of this crate (see dyn_object
). Internals of signals are more encapsulated.
spawn
rename
spawn
is now the unbounded spawn method, since dropping futures can cause unexpected behaviors and should be opt-in.