bevyengine / bevyengine/bevy

Pausing the virtual clock stops event updates.

Open
#14,152 4 comments 0 reactions 0 assignees View on GitHub
A-ECS A-Time C-Bug D-Modest S-Ready-For-Implementation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version

0.14

## What you did

_It could be I don't understand the intent behind `Time`. I thought it was meant as a gameplay clock separate from the wall clock in `Time`._

There is a footgun for games that want to use `Time` but which do not use a fixed update. If you pause `Time` then the `FixedUpdate` schedule does not run. If the `FixedUpdate` schedule does not run, events do not get updated.

This is because the `TimePlugin`, by default, sets the event updates to happen on the next `FixedUpdate`.

If you use events for UI, for example, and pause your game by pausing `Time` those events will start to accumulate until read or the game is unpaused. This is unexpected.

A game that doesn't want to use the `FixedUpdate`, but still wants to use `Time` for gametime and pausing must do this:

```rust
let mut event_registry = app
.world_mut()
.resource_mut::();
event_registry.should_update = ShouldUpdateEvents::Always;
```

## What to do?

Maybe `TimePlugin` should have configuration to select the event update strategy. However, I think that `FixedUpdate` games that pause the clock will be surprised by events accumulating? Or maybe `Time` is not intended to be used as a gameplay clock, just as pacing for `FixedUpdate`?

Contributor guide

Open the contributing guide

Research direction

Start by reading the TimePlugin behavior around event updates, then inspect EventRegistry.should_update and the FixedUpdate versus Always strategies described in the issue. Clarify the intended behavior when Time is paused, determine whether configuration or a default change is appropriate, and add coverage showing that events do not accumulate unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.