RealDocs

AActor::PostSaveRoot

function Engine Since 5.1
#include "GameFramework/Actor.h"
Access: public Specifiers: virtualoverride

Description

Called after the root object of a package has been saved. Use to restore any state that was modified during PreSaveRoot, or to trigger follow-up work that depends on the save having completed.

Caveats & Gotchas

  • Always call Super::PostSaveRoot() — the engine uses this to undo transformations applied during the save pass (e.g. level streaming adjustments).
  • The save may have failed; check ObjectSaveContext to determine success before assuming the file was written.
  • Symmetric with PreSaveRoot — any state you modified there should be restored here to avoid leaving the actor in a post-save-only state during continued editing.

Signature

ENGINE_API virtual void PostSaveRoot(FObjectPostSaveRootContext ObjectSaveContext) override;

Parameters

Name Type Description Default
ObjectSaveContext FObjectPostSaveRootContext Context describing the completed save, including success/failure and whether it was a cook.

Return Type

void

Example

Restore transient state after save C++
void AMyActor::PostSaveRoot(FObjectPostSaveRootContext ObjectSaveContext)
{
	Super::PostSaveRoot(ObjectSaveContext);
	if (ObjectSaveContext.IsSuccessful())
	{
		UE_LOG(LogTemp, Log, TEXT("Package saved successfully"));
	}
}

Version History

Introduced in: 5.1

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.