RealDocs

UBlueprintPathsLibrary::ChangeExtension

function Engine Blueprint Since 4.20
#include "Kismet/BlueprintPathsLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Changes the extension of the given filename. If the file has no extension to begin with, the path is returned unchanged.

Caveats & Gotchas

  • Unlike SetExtension, this does nothing when InPath has no existing extension — use SetExtension if you need to guarantee one is applied.
  • InNewExtension works with or without a leading dot, but mixing conventions inconsistently across a codebase makes output hard to predict at a glance.

Signature

static FString ChangeExtension(const FString& InPath, const FString& InNewExtension)

Parameters

Name Type Description Default
InPath const FString& The path or filename whose extension should be changed.
InNewExtension const FString& The new extension to apply, with or without a leading dot.

Return Type

FString

Example

Swap a texture extension C++
FString NewPath = UBlueprintPathsLibrary::ChangeExtension(TEXT("Content/Textures/Rock.png"), TEXT("tga"));
// NewPath == TEXT("Content/Textures/Rock.tga")

Version History

Introduced in: 4.20

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.