Progress()
Get the progress value.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine.LightTransport
- Assembly: UnityEngine.CoreModule
public float Progress()
Returns
Type | Description |
|---|---|
| float | Progress value in the range [0;1]. |
Remarks
Returns the current progress as a value between 0.0 and 1.0, where:
- 0.0 means no progress (operation just started).
- Values increase according to the rate of completion.
- 1.0 means the operation completed successfully.
The progress is calculated based on the ratio of completed work steps to total work steps set via BakeProgressState.SetTotalWorkSteps and updated via BakeProgressState.IncrementCompletedWorkSteps.
Examples
// Monitor progress during bakingusing var progress = new BakeProgressState();integrator.SetProgressReporter(progress);// Start baking operationvar bakeTask = Task.Run(() =>{ return integrator.IntegrateDirectRadiance( context, 0, probeCount, 1024, false, outputBuffer);});// Update UI with progresswhile (!bakeTask.IsCompleted){ float progressValue = progress.Progress(); progressBar.value = progressValue; progressText.text = $"{progressValue * 100:F1}%"; await Task.Delay(50); // Update at 20 FPS}progressBar.value = 1.0f;progressText.text = "Complete!";