Runtime systems12 / 13

Game updates and pausing

See what the SDK updates each frame and how it pauses the game.

The SDK updates the layout, scene services, physics, particles, and tweens in a fixed order. Game code takes part through component and service update methods.

01
layoutUpdates nodes and enabled components
02
sceneUpdates scene services. FsmDrivenScene emits SceneTick.
03
physicsUpdates services in the physics phase
04
particlesUpdates particles
05
tweensUpdates engine animations
One frame of the standard scheduler. Scene and component hooks receive dt in seconds.

Components use onUpdate(dt), and scene services use onSceneTick(ctx). A service with tickPhase: 'physics' updates during the physics phase.

Pause reasons

An inactive tab, a manual action, the platform, or an ad can pause the game. The game stays paused while any reason is active. When an ad ends, the game stays paused if the tab is still inactive.

TweenManager.delayMs stops counting while the game is paused.

Read the activity state to check whether the game is paused.

const snapshot = this.node.engine.activity.getSnapshot();
const paused = snapshot.effectivePaused;

activity.subscribe(handler) reports changes to the pause state and returns a function that unsubscribes.