Skip to content

Time ​

class in OpalScript

Gameplay clock, waits, and time groups for this Play world.

Properties ​

MemberDescription
Time.GroupThis object's time group: gameplay (default), presentation, or ui.
Time.DeltaTyped gameplay seconds elapsed for this callback.
Time.ElapsedTyped elapsed active gameplay time.
Time.SimulationElapsedTyped elapsed fixed simulation time.
Time.FixedDeltaTyped fixed simulation step duration.
Time.PhaseThe current engine execution phase.
Time.DeltaTimeElapsed gameplay seconds for this callback.
Time.TimeElapsed active gameplay time in seconds.
Time.SimulationTimeElapsed fixed simulation time in seconds.
Time.FixedDeltaTimeThe fixed simulation step in seconds.
Time.FrameThe current active gameplay frame index.
Time.TickThe current fixed simulation tick index.

Methods ​

MemberDescription
Time.Waitawait Time.Wait(seconds) inside an async method. Counts Play time from later frames; zero still waits until a later frame.
Time.NextFrameawait Time.NextFrame() resumes on a later active Play frame, independent of object/component order. Startup waits may resume in the first frame.
Time.CancelAllCancel this component's owned tasks and run their finally cleanup. Completed gameplay effects stay committed.
Time.SetGroupSet this object's time group: gameplay, presentation, or ui. Applies to all its components and native animation.
Time.PauseGroupPause gameplay, presentation, or ui time in this Play world.
Time.ResumeGroupResume gameplay, presentation, or ui time in this Play world.
Time.IsGroupPausedWhether gameplay, presentation, or ui time is paused in this Play world.

Example ​

csharp
public async void SpawnWave() {
    for (int i = 0; i < 5; i++) {
        GetComponent<Spawner>().SpawnNow();
        if (i + 1 < 5) await Time.Wait(0.4);
    }
}

See also ​