RealDocs

UKismetTextLibrary::AsPercent_Float

function Engine Blueprint Since unknown
#include "Kismet/KismetTextLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Formats a float as percent text, multiplying the value by 100 and appending a localized percent symbol.

Caveats & Gotchas

  • Value is a fraction, not a whole-number percentage — pass 0.5 to get "50%", not 50; passing 50 produces "5000%", a common source of display bugs.
  • The percent symbol's position and spacing is culture-dependent, so don't assume the symbol always trails the number with no space.

Signature

static FText AsPercent_Float(float Value, TEnumAsByte<ERoundingMode> RoundingMode, bool bAlwaysSign = false, bool bUseGrouping = true, int32 MinimumIntegralDigits = 1, int32 MaximumIntegralDigits = 324, int32 MinimumFractionalDigits = 0, int32 MaximumFractionalDigits = 3);

Parameters

Name Type Description Default
Value float The value to format as a percent, where 1.0 represents 100%.
RoundingMode TEnumAsByte<ERoundingMode> How fractional digits beyond the maximum should be rounded.
bAlwaysSign bool Whether to always show a sign (+/-), even for positive values. false
bUseGrouping bool Whether to insert culture-appropriate thousands separators. true
MinimumIntegralDigits int32 Minimum number of integer digits to display. 1
MaximumIntegralDigits int32 Maximum number of integer digits to display. 324
MinimumFractionalDigits int32 Minimum number of fractional digits to display. 0
MaximumFractionalDigits int32 Maximum number of fractional digits to display before rounding. 3

Return Type

FText

Example

Display a completion fraction as a percent C++
float Progress = 0.5f;
FText ProgressText = UKismetTextLibrary::AsPercent_Float(Progress, ERoundingMode::HalfToEven); // "50%"

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.