Version: 2021.1

Progress

class in UnityEditor

切换到手册

描述

The Progress utility class reports the progress of asynchronous tasks to Unity.

public IEnumerator Run_OneTask()
{
    // Create a new progress indicator
    int progressId = Progress.Start("Running one task", 0);

// Report the progress status at anytime for (int frame = 0; frame <= 1000; ++frame) { Progress.Report(progressId, "any progress update or null if it hasn't changed", frame / 1000.0f);

// Do something else yield return null; }

// The task is finished. Remove the associated progress indicator. Progress.Remove(progressId); }

静态变量

globalProgressReturns the global average progression of all running tasks.
globalRemainingTimeReturns the maximum time remaining for all running progress indicators.
runningReturns true if there is at least one running progress indicator, false otherwise.

静态函数

CancelCancels a runnning progress indicator, and invokes the cancel callback for the associated task.
ClearRemainingTimeResets the computation of a progress indicator's remaining time.
EnumerateItemsReturns an enumerator to loop over all progress indicators.
ExistsChecks whether a progress indicator with the specified ID exists.
FinishMarks the progress indicator as finished.
GetCountGets the number of available progress indicators.
GetCountPerStatusFor each available status, gets the number of progress indicators with that status.
GetCurrentStepGets the current step for a progress indicator.
GetDescriptionGets a progress indicator's description.
GetIdFinds a progress indicator's unique ID using its index in the set of all available progress indicators.
GetNameGets a progress indicator's name.
GetOptionsGets the options that you specified when you started the progress indicator.
GetParentIdGets the unique ID of the progress indicator's parent, if any.
GetPriorityGets a progress indicator's priority.
GetProgressGets a progress indicator's progress.
GetProgressByIdGets information about a progress indicator.
GetRemainingTimeGets a progress indicator's remaining time, in seconds.
GetRunningProgressCountGets the number of active or running progress indicators.
GetStartDateTimeGets the timestamp of when the progress indicator started.
GetStatusGets the progress indicator's status.
GetStepLabelGets the label that displays a progress indicator's steps.
GetTimeDisplayModeGet a progress indicator's time display mode.
GetTotalStepsGets the total number of steps, from start to finish, for a progress indicator.
GetUpdateDateTimeGets the time that the progress indicator last changed, or finished.
IsCancellableIndicates whether you can cancel the progress indicator's associated task.
IsPausableIndicates whether you can pause the progress indicator's task.
PausePauses a runnning progress indicator, and invokes the pause callback for its task.
RegisterCancelCallbackRegisters a callback that is called when the user cancels a running progress indicator's associated task.
RegisterPauseCallbackRegisters a callback that is called when the user pauses a running progress indicator's task.
RemoveFinishes and removes an active progress indicator.
ReportReports a running progress indicator's current status.
ResumeResumes a paused progress indicator, and invokes the pause callback for the associated task.
SetDescriptionSets the progress indicator's description. To clear the description pass null.
SetPrioritySets a progress indicator's priority.
SetRemainingTimeSets the progress indicator's remaining time, in seconds.
SetStepLabelSets the label that displays a progress indicator's steps.
SetTimeDisplayModeSet a progress indicator's time display mode.
ShowDetailsOpens the progress window for background tasks.
StartThis method starts a new progress indicator.
UnregisterCancelCallbackUnregisters a previously registered progress cancellation callback.
UnregisterPauseCallbackUnregisters a previously registered progress pause callback.

Events

addedAn event raised when a new progress indicator starts.
removedAn event raised when a progress indicator is removed.
updatedAn event raised when a progress indicator's state updates.