文档

Unity Engine


User Manual

Script Reference

Unity Engine


SetProgressReporter(BakeProgressState)

Configures progress tracking for integration operations.
阅读时间1 分钟最后更新于 24 天前

Definition

void SetProgressReporter(BakeProgressState progress)

Parameters

Progress state object that will receive updates during integration.

Remarks

Sets up 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.

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;