GGua REFERENCE日本語GitHub ↗
GUIDE / VIRTUAL CLOCK

Pause and advance GuaClock-driven game logic

Game logic that uses GuaClock as its time source can be paused and advanced without waiting for wall time.

What can be paused?

Time-dependent behaviorControlled by GuaClock?
Callbacks scheduled on GuaClockYes
Logic updated from the GuaClock tick streamYes
Godot Timer / SceneTreeTimerNo, unless the logic is migrated to GuaClock
Unity Time.deltaTime / WaitForSeconds / CoroutineNo, unless the logic is migrated to GuaClock
Physics, animation, audio, OS time, networkingNo

Think of integration as two separate steps: production game code receives GuaClock as its time source, and test code installs and controls that same shared clock. “Install” activates the virtual clock; it does not install itself into arbitrary game objects.

Connect game logic, then control it

Game-side integrationcsharp
// Replace the native timer used by this game subsystem.
var clock = GuaUnityRuntime.Clock;
clock.Schedule(TimeSpan.FromSeconds(2), ShowMessage);

// Tick-driven systems can subscribe to clock.Tick instead.
clock.Tick += UpdateCountdown;
Godot game-side integrationgdscript
# Replace the Timer used by this game subsystem.
gua.clock_schedule(2000.0, _show_message)

# Tick-driven systems can subscribe to clock_tick instead.
gua.clock_tick.connect(_update_countdown)
Test-side controlcsharp
GuaClockControls.InstallClock(host.Context);
GuaClockControls.PauseClock(host.Context);
GuaClockControls.RunClockFor(host.Context, TimeSpan.FromSeconds(2));

GuaAssertions.WaitForText(host.Context, "Ready").ToBeVisible();
OperationEffect
InstallStarts a monotonic Gua clock at zero in running state.
PauseFreezes GuaClock time while the bridge and semantic UI collection keep running.
RunForExecutes due callbacks and tick slices, reaches the exact requested time, and stays paused.
ResumeReturns GuaClock to adapter-provided unscaled real-time advancement.

Godot and Unity

In Godot, migrate the target logic to GuaAutoAdapter.clock_schedule or its clock_tick signal. In Unity, inject or access GuaUnityRuntime.Clock and use Schedule or Tick. Their adapter pumps continue serving bridge commands while GuaClock is paused.

Remote controls

The WebSocket protocol, MCP server, and Inspector share get_clock, clock_install, clock_pause, clock_run_for, and clock_resume. .NET tests use the matching synchronous or asynchronous GuaClockControls methods.