Navigation
API > API/Plugins > API/Plugins/FileSandboxCore
Manages the lifetime of the ISandboxInstance. For now, only one sandbox can be active at any given time and all files in mount points are sandboxed.
===== Overview ===== During sandbox, any I/O operations that modify, delete, or add files in mount points (e.g. /Game/..., /Engine/..., /MyPlugin/..., etc.) will be sandboxed. That means those operations are performed in a separate sandbox file system without changing the underlying files. At any time, you can persist changes, i.e. apply them to the underlying file system where the real files reside.
==== Example =====
The user opens the asset "Game/Levels/MyBlueprint.uasset", changes it, and then clicks save.
The contained UObjects are serialized and a low-level I/O operation is triggered (via IPlatformFile). 2.1 Normally, the data would be written "D:/MyProject/Content/Levels/MyBlueprint.uasset", 2.2 But we redirect the data to a sandboxed location, e.g."D:/MyProject/Intermediate/Sandboxes/YourSandbox/Sandbox/Game". Similar behaviour goes for when a file is deleted or added.
==== Persisting ===== Persisting effectively means to apply the changes to the original files. Files marked for delete are deleted from the original location. Added and modified files are copied from the sandbox location to the original location, e.g. a modified file "D:/MyProject/Content/Levels/MyBlueprint.uasset" would be replaced with "D:/MyProject/Intermediate/Sandboxes/YourSandbox/Sandbox/Game".
===== Sandbox file structure ===== By default, sandboxes are saved to the Intermediate/Sandboxes directory ( The directory contains a "Manifest.json" file at the root level; it contains bookkeeping data (which files were added, modified, deleted) and metadata, such as user given description and custom metadata specific to the business logic. So for example, there would be a file "MyProject/Intermediate/Sandboxes/MySandbox/Manifest.json".
Furthermore, changed and added files are saved in the sub-directory "Sandbox". This directory contains one directory name per mount point, like "Game", "Engine", "MyPlugin". Within those mount point directories files are added according to the folder structure of the package name. So for example:
- "MyProject/Intermediate/Sandboxes/MySandbox/Sandboxes/Game/Levels/MyLevel.uasset" maps to "Game/Levels/MyLevel.uasset" (mount = "/Game/"
- "MyProject/Intermediate/Sandboxes/MySandbox/Sandboxes/MyPlugin/FooBlueprint.uasset" maps to "MyPlugin/FooBlueprint.uasset" (mount = "/MyPlugin/")
| Name | ISandboxManager |
| Type | class |
| Header File | /Engine/Plugins/Developer/Sandbox/FileSandbox/Source/FileSandboxCore/Public/ISandboxManager.h |
| Include Path | #include "ISandboxManager.h" |
Syntax
class ISandboxManager
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~ISandboxManager() |
ISandboxManager.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool CanLeaveSandbox() |
ISandboxManager.h | ||
ELeaveSandboxErrorCode CanLeaveSandboxWithReason() |
ISandboxManager.h | ||
FNewSandboxResult CreateNewSandbox
(
const FNewSandboxArgs& InArgs |
Puts the engine into a sandbox: This creates a new environment. | ISandboxManager.h | |
FDeleteSandboxResult DeleteNamedSandbox
(
const FDeleteSandboxByNameArgs& InArgs |
Deletes the sandbox with the given name, if found. | ISandboxManager.h | |
FDeleteSandboxResult DeleteSandbox
(
const FDeleteSandboxByDirectoryArgs& InArgs |
Advanced version of DeleteNamedSandbox for when you know the specific root directory of a sandbox. | ISandboxManager.h | |
void EnumerateFileChanges
(
const FString& InSandboxRootPath, |
Alternative version that uses the sandbox root directory instead. | ISandboxManager.h | |
void EnumerateFileChangesByName
(
const FString& InSandboxName, |
Invokes InProcess for every effective file change that would be performed if the sandbox was persisted. | ISandboxManager.h | |
| More advanced version of CanLeaveSandbox if you want to find out the reason why the sandbox cannot be left. | ISandboxManager.h | ||
| Gets the currently active global sandbox instance. | ISandboxManager.h | ||
| ISandboxManager.h | |||
bool HasActiveSandbox() |
ISandboxManager.h | ||
FLeaveSandboxResult LeaveSandbox
(
const FLeaveSandboxArgs& InLeaveArgs |
Leaves the current sandbox. | ISandboxManager.h | |
FLoadSandboxResult LoadNamedSandbox
(
const FLoadSandboxByNameArgs& InArgs |
Puts the engine into a sandbox: applies the state from a pre-existing sandbox to any open assets. | ISandboxManager.h | |
FLoadSandboxResult LoadSandbox
(
const FLoadSandboxByDirectoryArgs& InLoadArgs |
Advanced version of LoadNamedSandbox for when you know the specific root directory of a sandbox. | ISandboxManager.h | |
FSandboxShutdownEvent & OnPostSandboxShutdown() |
ISandboxManager.h | ||
FSandboxInstanceEvent & OnPostSandboxStartup() |
ISandboxManager.h | ||
FSandboxInstanceEvent & OnPreSandboxShutdown() |
ISandboxManager.h |
Public Virtual
See Also
-
GetBaseSandboxDirectory). Sandboxes are stored in separate directories
-
e.g. a sandbox named "MySandbox" would be saved in "MyProject/Intermediate/Sandboxes/MySandbox".