SetTotalWorkSteps(ulong)
Sets the total amount of work steps for the progress state. Increase the completed work steps using BakeProgressState.IncrementCompletedWorkSteps.
Read time 1 minuteLast updated 10 days ago
Definition
- Type: Method
- Namespace: UnityEngine.LightTransport
- Assembly: UnityEngine.CoreModule
public void SetTotalWorkSteps(ulong total)
Parameters
Total amount of work steps.
Remarks
Configures the total expected work for progress calculation. This value is used as the denominator when calculating progress percentages. The total should represent meaningful work units for the operation being performed.
Guidelines for Setting Total Steps:
- Use consistent units (e.g., number of probes to process).
- Estimate conservatively to avoid progress going backwards.
- Consider breaking large operations into sub-operations with their own totals.
- Set the total before starting work and avoid changing it during execution.
Examples
// Configure progress for different operation typesusing var progress = new BakeProgressState();// For probe integration: total = number of probesint probeCount = 256;progress.SetTotalWorkSteps((ulong)probeCount);integrator.SetProgressReporter(progress);// For world population: estimate based on scene complexityint estimatedSteps = input.bakeInput.instanceCount + input.bakeInput.meshCount * 10;progress.SetTotalWorkSteps((ulong)estimatedSteps);InputExtraction.PopulateWorld(input, progress, context, world);// For custom operations: use logical work unitsint totalTextures = materials.Length;progress.SetTotalWorkSteps((ulong)totalTextures);foreach (var material in materials){ ProcessMaterialTextures(material); progress.IncrementCompletedWorkSteps(1);}