Time
class in OpalScript
Gameplay clock, waits, and time groups for this Play world.
Properties
| Member | Description |
|---|---|
| Time.Group | This object's time group: gameplay (default), presentation, or ui. |
| Time.Delta | Typed gameplay seconds elapsed for this callback. |
| Time.Elapsed | Typed elapsed active gameplay time. |
| Time.SimulationElapsed | Typed elapsed fixed simulation time. |
| Time.FixedDelta | Typed fixed simulation step duration. |
| Time.Phase | The current engine execution phase. |
| Time.DeltaTime | Elapsed gameplay seconds for this callback. |
| Time.Time | Elapsed active gameplay time in seconds. |
| Time.SimulationTime | Elapsed fixed simulation time in seconds. |
| Time.FixedDeltaTime | The fixed simulation step in seconds. |
| Time.Frame | The current active gameplay frame index. |
| Time.Tick | The current fixed simulation tick index. |
Methods
| Member | Description |
|---|---|
| Time.Wait | await Time.Wait(seconds) inside an async method. Counts Play time from later frames; zero still waits until a later frame. |
| Time.NextFrame | await Time.NextFrame() resumes on a later active Play frame, independent of object/component order. Startup waits may resume in the first frame. |
| Time.CancelAll | Cancel this component's owned tasks and run their finally cleanup. Completed gameplay effects stay committed. |
| Time.SetGroup | Set this object's time group: gameplay, presentation, or ui. Applies to all its components and native animation. |
| Time.PauseGroup | Pause gameplay, presentation, or ui time in this Play world. |
| Time.ResumeGroup | Resume gameplay, presentation, or ui time in this Play world. |
| Time.IsGroupPaused | Whether 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);
}
}