RealDocs

FSoftObjectPath::PreSavePath

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

Description

Called by the save system immediately before an asset is saved; resolves any pending core redirects so the on-disk path is always up to date.

Caveats & Gotchas

  • This is an engine-internal hook invoked by USavePackage and the cooker. Calling it manually in gameplay code is almost never correct and can cause double-fixup issues if the engine later calls it again during the actual save.
  • Returns true if the path changed as a result of redirect resolution. If bReportSoftObjectPathRedirects is provided, the engine uses it to emit a warning when saving a package that contains stale soft references.

Signature

COREUOBJECT_API bool PreSavePath(bool* bReportSoftObjectPathRedirects = nullptr)

Parameters

Name Type Description Default
bReportSoftObjectPathRedirects bool* If non-null, receives true if the path was changed by a redirect during pre-save. nullptr

Return Type

bool

Example

Check whether a path has a pending redirect before save C++
// Only call this in a custom save pipeline — not in gameplay code
bool bWasRedirected = false;
bool bChanged = MySoftPath.PreSavePath(&bWasRedirected);
if (bWasRedirected)
{
    UE_LOG(LogTemp, Warning, TEXT("Soft path was redirected during pre-save: %s"), *MySoftPath.ToString());
}

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.