Orrery Terrain · OrreryTerrain module · member function
UOrreryTerrainSubsystem::
SaveTerrainToFile
Write the terrain's save file: a snapshot pinned now (the world may go on changing), streamed on a task into <Path>.tmp, flushed and renamed over Path.
Declaration
EOrreryTerrainSaveResult SaveTerrainToFile(const FString& Path, FOnTerrainFileSaved 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
- Every member function is game thread unless it says otherwise. (the rule of UOrreryTerrainSubsystem)
Description
Any size; nothing is held whole in memory. Allowed on a read-only terrain. The game's own save keeps the result's Path, FileHash and StateHash (FOrreryTerrainSaveRef, <slot>.<n>.tsterrain).
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
Path | const FString& | — | Absolute file path to write; the temporary file is beside it. |
Done | FOn | — | Called from Tick on the game thread when the write ends, only if this returns Ok. |
Options | const FOrrery | FOrrery | What the save keeps. |
Returns
Ok when the write started; NoTerrain; Busy while a save is in flight; WriteFailed when Path is the file this terrain pages from (save to a new name, then delete the old one).