UBlueprintPathsLibrary::CreateTempFilename
#include "Kismet/BlueprintPathsLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Generates a filename that doesn't already exist inside Path, using Prefix and Extension, suitable for scratch/temporary file use.
Caveats & Gotchas
- • This only generates a unique name — it does not create the file on disk, so there's a small race window before you actually open it for writing.
- • Path must already exist; the function does not create the target directory.
- • Extension must include the leading dot (e.g. ".tmp"), matching the pattern used throughout FPaths.
Signature
static ENGINE_API FString CreateTempFilename(const FString& Path, const FString& Prefix = TEXT(""), const FString& Extension = TEXT(".tmp")); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Path | const FString& | Directory the temp filename should be created in. | — |
| Prefix | const FString& | Prefix to prepend to the generated filename. | TEXT("") |
| Extension | const FString& | File extension to append, including the leading dot. | TEXT(".tmp") |
Return Type
FString Example
Create a scratch file path for exporting data C++
FString TempFile = UBlueprintPathsLibrary::CreateTempFilename(FPaths::ProjectSavedDir(), TEXT("Export_"), TEXT(".json"));
FFileHelper::SaveStringToFile(JsonString, *TempFile); Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?