pub struct ChangeTracker<T>where
T: Component,{ /* private fields */ }
Expand description
Helper to track changes in T
components
For each entity with a T
component, a private component is inserted which stores the value as
of the most recent call to track
. This provides robust, exact change detection at the cost of
visiting each possibly-changed entity. It is a good fit for entities that will typically be
visited regardless, and components having fast Clone
and PartialEq
impls. For components
which are expensive to compare and/or clone, consider instead tracking changes manually, e.g.
by setting a flag in the component’s DerefMut
implementation.
Always use exactly one ChangeTracker
per World
per component type of interest. Using
multiple trackers of the same T
on the same world, or using the same tracker across multiple
worlds, will produce unpredictable results.