Investigate providing &mut world
in tweenable callback vs. using events
#3
Labels
enhancement
New feature or request
&mut world
in tweenable callback vs. using events
#3
Currently a tweenable callback has little information. It contains a reference to the
Tween<T>
, and (change not merged yet) theEntity
of theAnimator<T>
orAssetAnimator<T>
.Kero on Discord suggested providing a
&mut world
to allow the callback to do something useful, similar to whatbevy-tick-timers
does. But this forces the system ticking the animators to take a global lock and become exclusive, serializing execution and being a potential choke point for other Bevy systems, which can cause performance issues. This is particularly bad forbevy_tweening
which has a series of such systems, once per component type:bevy_tweening/src/plugin.rs
Lines 48 to 59 in 38e9939
A possible alternative which sounds more Bevy-esque would be to replace the callback with a Bevy event. This way the user app can design any system they want to read that event, with any resource / query they need. This however implies being able to write an event without knowing its type at build time, to avoid depending on the event type as an extra generic parameter for the system:
then
The text was updated successfully, but these errors were encountered: