SetProgressReporter(BakeProgressState)
Configures progress tracking for integration operations.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Method
- Namespace: UnityEngine.LightTransport
- Assembly: UnityEngine.CoreModule
void SetProgressReporter(BakeProgressState progress)
Parameters
Progress state object that will receive updates during integration.
Remarks
Set a BakeProgressState on the integrator for progress reporting for long-running integration operations. The integrator updates the progress state during execution, allowing external systems to display progress information and handle cancellation requests.
The progress reporter provides:
- Completion percentage (0.0 to 1.0).
- Ability to cancel operations.
- Work step tracking for detailed progress.
Additional Resources: BakeProgressState.Progress, BakeProgressState.Cancel.
Examples
var integrator = new RadeonRaysProbeIntegrator();using var progress = new BakeProgressState();integrator.SetProgressReporter(progress);// Start integration in backgroundvar integrationTask = Task.Run(() =>{ return integrator.IntegrateDirectRadiance(context, 0, 1000, 2048, false, outputBuffer);});// Monitor progresswhile (!integrationTask.IsCompleted){ float currentProgress = progress.Progress(); Debug.Log($"Integration progress: {currentProgress * 100:F1}%"); // Allow user to cancel if (userRequestedCancel) { progress.Cancel(); } await Task.Delay(100);}var result = await integrationTask;