UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FSlowTask Struct Reference

#include <SlowTask.h>

+ Inheritance diagram for FSlowTask:

Public Member Functions

CORE_API FSlowTask (float InAmountOfWork, const FText &InDefaultMessage=FText(), bool bInEnabled=true, FFeedbackContext &InContext= *GWarn)
 
CORE_API void Initialize ()
 
CORE_API void Destroy ()
 
CORE_API void MakeDialogDelayed (float Threshold, bool bShowCancelButton=false, bool bAllowInPIE=false)
 
CORE_API void MakeDialog (bool bShowCancelButton=false, bool bAllowInPIE=false)
 
CORE_API void EnterProgressFrame (float ExpectedWorkThisFrame=1.f, const FText &Text=FText())
 
CORE_API void TickProgress ()
 
CORE_API void ForceRefresh ()
 
CORE_API const FTextGetCurrentMessage () const
 
CORE_API bool ShouldCancel () const
 

Static Public Member Functions

static CORE_API bool ShouldCreateThrottledSlowTask ()
 

Public Attributes

FText DefaultMessage
 
FText FrameMessage
 
float TotalAmountOfWork
 
float CompletedWork
 
float CurrentFrameScope
 
ESlowTaskVisibility Visibility
 
double StartTime
 
TOptional< floatOpenDialogThreshold
 

Detailed Description

Data type used to store information about a currently running slow task. Direct use is not advised, use FScopedSlowTask instead

Constructor & Destructor Documentation

◆ FSlowTask()

FSlowTask::FSlowTask ( float  InAmountOfWork,
const FText InDefaultMessage = FText(),
bool  bInEnabled = true,
FFeedbackContext InContext = *GWarn 
)

Construct this scope from an amount of work to do, and a message to display

Parameters
InAmountOfWorkArbitrary number of work units to perform (can be a percentage or number of steps). 0 indicates that no progress frames are to be entered in this scope (automatically enters a frame encompassing the entire scope)
InDefaultMessageA message to display to the user to describe the purpose of the scope
bInVisibleWhen false, this scope will have no effect. Allows for proper scoped objects that are conditionally hidden.

Member Function Documentation

◆ Destroy()

void FSlowTask::Destroy ( )

Function that finishes any remaining work and removes itself from the global scope stack

◆ EnterProgressFrame()

void FSlowTask::EnterProgressFrame ( float  ExpectedWorkThisFrame = 1.f,
const FText Text = FText() 
)

Indicate that we are to enter a frame that will take up the specified amount of work. Completes any previous frames (potentially contributing to parent scopes' progress).

Parameters
ExpectedWorkThisFrameThe amount of work that will happen between now and the next frame, as a numerator of TotalAmountOfWork.
TextOptional text to describe this frame's purpose.

◆ ForceRefresh()

void FSlowTask::ForceRefresh ( )

Whenever we encounter edge condition requiring to force a UI refresh (Like if another popup would show when the slow task finishes and you want it to show 100%)

◆ GetCurrentMessage()

const FText & FSlowTask::GetCurrentMessage ( ) const

Get the frame message or default message if empty

◆ Initialize()

void FSlowTask::Initialize ( )

Function that initializes the scope by adding it to its context's stack

◆ MakeDialog()

void FSlowTask::MakeDialog ( bool  bShowCancelButton = false,
bool  bAllowInPIE = false 
)

Creates a new dialog for this slow task, if there is currently not one open

Parameters
bShowCancelButtonWhether to show a cancel button on the dialog or not
bAllowInPIEWhether to allow this dialog in PIE. If false, this dialog will not appear during PIE sessions.

◆ MakeDialogDelayed()

void FSlowTask::MakeDialogDelayed ( float  Threshold,
bool  bShowCancelButton = false,
bool  bAllowInPIE = false 
)

Creates a new dialog for this slow task after the given time threshold. If the task completes before this time, no dialog will be shown.

Parameters
ThresholdTime in seconds before dialog will be shown.
bShowCancelButtonWhether to show a cancel button on the dialog or not
bAllowInPIEWhether to allow this dialog in PIE. If false, this dialog will not appear during PIE sessions.

◆ ShouldCancel()

bool FSlowTask::ShouldCancel ( ) const

True if the user has requested that the slow task be canceled

◆ ShouldCreateThrottledSlowTask()

bool FSlowTask::ShouldCreateThrottledSlowTask ( )
static

True if a slow task should be created. False if a slow task should not be created because another was created recently.

◆ TickProgress()

void FSlowTask::TickProgress ( )

Let the UI refresh but doesn't advance progress. This should be called at regular intervals even when no progress is being made to keep the UI responsive.

Member Data Documentation

◆ CompletedWork

float FSlowTask::CompletedWork

The amount of work we have already completed in this scope

◆ CurrentFrameScope

float FSlowTask::CurrentFrameScope

The amount of work the current frame is responsible for

◆ DefaultMessage

FText FSlowTask::DefaultMessage

Default message to display to the user when not overridden by a frame

◆ FrameMessage

FText FSlowTask::FrameMessage

Message pertaining to the current frame's work

◆ OpenDialogThreshold

TOptional<float> FSlowTask::OpenDialogThreshold

Threshold before dialog is opened

◆ StartTime

double FSlowTask::StartTime

The time that this scope was created

◆ TotalAmountOfWork

float FSlowTask::TotalAmountOfWork

The amount of work to do in this scope

◆ Visibility

ESlowTaskVisibility FSlowTask::Visibility

The visibility of this slow task


The documentation for this struct was generated from the following files: