-
Notifications
You must be signed in to change notification settings - Fork 47
Description
When a rollback is triggered, bevy_ggrs restores a saved world snapshot. It updates components by first removing them, and then adding them again. This triggers all queries with Added<Component> or Changed<Component> in it, regardless of whether the component was already there and whether it changed.
bevy_ggrs/src/world_snapshot.rs
Line 177 in b730a0b
| reflect_component.remove(world, entity); |
Sometimes systems have queries that react to other components being added or changed, triggering changes on every rollback. Sometimes, this just causes a small performance hit, other times, it leads to buggy behavior because setup code runs multiple times.
Describe the solution you'd like
Perhaps it's possible to only update the component if it's different?
Additional context
In regular game code, this is usually quite easy to fix or work around, but sometimes the affected code belongs to 3rd party crates, which are a lot harder to solve.