Skip to content
Brass Orrery

Orrery Terrain · OrreryTerrain module · member function

UOrreryTerrainSubsystem::

SaveTerrainAsync

Save the terrain beside a game's save slot, streamed on a task: the file is Slot.N.suffix in GetSaveDirectory, where N is one more than the highest existing N of the slot, so a world that pages from the previous save never has its file written over.

Declaration

void SaveTerrainAsync(const FString& SlotName, int32 UserIndex, FOnTerrainSaved Done,
                      const FOrreryTerrainSaveOptions& Options = FOrreryTerrainSaveOptions());
Header
#include "OrreryTerrainSubsystem.h"
Module
PublicDependencyModuleNames.Add("OrreryTerrain"); in your module’s Build.cs.
Stability
Stable: changes within a major version only add.
Thread
Game thread.

Description

When the new file is on disk, older files of the slot that no terrain pages from (IsTerrainFileInUse) are deleted; one still in use is kept and retried at the next save.

A world with a lost sculpt code (a damaged file it was loaded from) refuses to save: Result is ReadFailed and LostCodes says how many (GetSculptPagingStats().World.LostCodes).

Parameters

NameTypeDefaultMeaning
SlotNameconst FString&—

The game's slot name; a path separator, a character a file name cannot hold, or more than 100 characters answers BadSlot.

UserIndexint32—

The platform user; 0 on desktop. Non-zero users get their own files (Slot.uK.N).

DoneFOnTerrainSaved—

Called on the game thread exactly once, with the result and, when Ok, the reference to keep in the game's own USaveGame. It may run before this function returns, when the save cannot start.

Optionsconst FOrreryTerrainSaveOptions&FOrreryTerrainSaveOptions()

What the save keeps, as SaveTerrainToFile.

Note.

Game thread. One save is in flight at a time (Busy). Allowed on a read-only terrain.