Juicy Actions Clock

v1.0

Juicy Actions includes an internal Clock System called the Juicy Actions Clock (JuicyActionsClock). This clock is a lightweight, global timing layer that all Juicy Actions — and all ActionExecutor instances — automatically use.

By default, the Juicy Actions Clock mirrors Unity's built-in Time values, but it can also:

  • apply pausing and local time scaling

  • be replaced by your own custom time source (such as Magic Time or another clock system)

  • provide consistent, deterministic time values for all Juicy Actions, regardless of scene setup

Key Features

Feature
Description

Singleton access

Use JuicyActionsClock.Instance from anywhere.

Implements IClock

Works seamlessly with ActionExecutor, actions, and resolvers.

No scene setup required

Lazy-loaded on first use.

Pause and Resume control

Temporarily stop all delta-based actions without stopping Unity's time.

Local time scaling

Multiply or reduce perceived time progression for all actions.

Custom provider support

Replace the default Unity time provider with your own system (e.g. Magic Time).

How It Works

All Juicy Actions fetch their time and delta values through an interface called IClock.

Singleton access from any script:

float deltaTime = JuicyActionsClock.Instance.DeltaTime;

// Slow time by half
JuicyActionsClock.Instance.TimeScale = 0.5f;

When you run any action:

float deltaTime = Executor.Clock.DeltaTime;

The executor does not read from UnityEngine.Time.deltaTime directly. Instead, it reads from JuicyActionsClock.Instance, which internally wraps a time provider. This provider can be:

  • the default Unity clock (Time.time, Time.deltaTime), or

  • a custom provider that you install (e.g. Magic Time, custom physics clock, etc.)

What the Clock Returns

Property
Description
Default Value

Time

The current time (seconds since startup).

UnityEngine.Time.time

UnscaledTime

Time ignoring Unity's Time.timeScale.

UnityEngine.Time.unscaledTime

DeltaTime

Time elapsed since the last frame. Affected by pause and local scale.

Time.deltaTime

UnscaledDeltaTime

Delta time ignoring all scaling or pausing.

Time.unscaledDeltaTime

TimeScale

Local multiplier applied to delta time (independent of Unity's).

1.0f

IsPaused

Whether the overlay pause layer is currently active.

false

By default, all of these values exactly mirror Unity's Time values. Modify them only if you want local control (for example, pausing an ActionExecutor while gameplay continues).

Some Actions will modify the timescale as well, automatically.

Modifying the Clock

Pause / Resume

Pause or resume all Juicy Actions globally:

JuicyActionsClock.Instance.Pause();
JuicyActionsClock.Instance.Resume();

When paused:

  • IsPaused becomes true.

  • DeltaTime returns 0.

  • Actions that depend on time progression (e.g. Move, Wait, Fade) will freeze in place until resumed.

Time Scaling

Adjust the clock's local time scale to slow down or speed up the action system:

JuicyActionsClock.Instance.TimeScale = 0.5f;  // half speed
JuicyActionsClock.Instance.TimeScale = 2.0f;  // double speed

This multiplies the clock's DeltaTime, allowing slow-motion or fast-forward effects independent of Unity's Time.timeScale.

Custom Clock Providers

Replace the base time source with your own implementation. Useful if your game has its own time system or uses a local time controller like Magic Time.

Last updated

Was this helpful?