RealDocs

UKismetTextLibrary::AsMemory

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

Description

Generates localized text that represents a byte count as a human-readable memory size, choosing the appropriate unit (KB/MiB/GB/etc.) automatically.

Caveats & Gotchas

  • IEC (the default) uses 1024-based units but still labels them with SI-style names in some cultures — verify the exact unit strings your target locale produces if displaying to end users who care about the distinction.
  • Passing a negative NumBytes is not validated by the function itself and produces a signed, formatted result rather than an error.
  • All the numeric formatting defaults are duplicated from FNumberFormattingOptions per an engine source comment — don't assume they always match FText::AsNumber defaults across engine versions.

Signature

static FText AsMemory(int64 NumBytes, TEnumAsByte<EMemoryUnitStandard> UnitStandard = EMemoryUnitStandard::IEC, bool bUseGrouping = true, int32 MinimumIntegralDigits = 1, int32 MaximumIntegralDigits = 324, int32 MinimumFractionalDigits = 0, int32 MaximumFractionalDigits = 3);

Parameters

Name Type Description Default
NumBytes int64 The size in bytes to format.
UnitStandard TEnumAsByte<EMemoryUnitStandard> Whether to use 1024-based (IEC, e.g. MiB) or 1000-based (SI, e.g. MB) units. EMemoryUnitStandard::IEC
bUseGrouping bool Whether to insert culture-appropriate thousands separators. true
MinimumIntegralDigits int32 Minimum number of digits before the decimal point. 1
MaximumIntegralDigits int32 Maximum number of digits before the decimal point. 324
MinimumFractionalDigits int32 Minimum number of digits after the decimal point. 0
MaximumFractionalDigits int32 Maximum number of digits after the decimal point. 3

Return Type

FText

Example

Show a download size in the UI C++
int64 Bytes = 15728640; // 15 MiB
FText SizeText = UKismetTextLibrary::AsMemory(Bytes); // "15.0 MiB"

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.