RealDocs

FSoftObjectPath::RemapPackage

function CoreUObject Since 4.18
#include "UObject/SoftObjectPath.h"
Access: public

Description

If this path's package component matches OldPackageName, replaces it with NewPackageName and returns true. Returns false and leaves the path unmodified when the package does not match.

Caveats & Gotchas

  • Only the package component is compared and replaced. The asset name and sub-object path are preserved verbatim — verify that the asset name is valid in the destination package before relying on the remapped path.
  • This is called internally by the engine's FixupForPIE and CoreRedirects resolution logic. Manually calling it on a path that is actively tracked by a streaming handle can desync the handle and the stored path.

Signature

COREUOBJECT_API bool RemapPackage(FName OldPackageName, FName NewPackageName);

Parameters

Name Type Description Default
OldPackageName FName The package name to be replaced.
NewPackageName FName The package name to replace it with.

Return Type

bool

Example

Apply a package rename to a cached soft reference C++
FSoftObjectPath CachedRef(TEXT("/Game/OldFolder/T_Stone.T_Stone"));
bool bUpdated = CachedRef.RemapPackage(
    FName(TEXT("/Game/OldFolder/T_Stone")),
    FName(TEXT("/Game/NewFolder/T_Stone")));
if (bUpdated)
{
    UE_LOG(LogTemp, Log, TEXT("Remapped to: %s"), *CachedRef.ToString());
}

Version History

Introduced in: 4.18

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.