Skip to content

Simplygon Scene Context for C++ ​

USimplygonSceneContext is an opaque UObject handle to a Simplygon scene owned by the Simplygon module. Retain the context until all operations using it have completed, then call Release() for deterministic cleanup. The scene manager validates the context lifetime and serializes access to the underlying SDK scene.

For a complete workflow, see Managed Scene Export and Capture. Native tools that need direct scene access can use FSimplygonSceneManager.

Methods ​

NameDescription
IsValidCheck whether the manager still owns the represented scene.
SaveToFileSave the managed scene synchronously from a worker thread.
SaveToFileAsyncSave the managed scene on a dedicated worker thread.
LoadFromFileLoad a scene synchronously and return a managed context.
LoadFromFileAsyncLoad a scene on a dedicated worker thread.
ReleaseDeterministically unregister and release the managed scene.

Lifetime ​

The UObject controls the Unreal handle lifetime, while the manager owns the Simplygon SDK scene. Garbage collection calls Release() through BeginDestroy(), but callers should release contexts explicitly when prompt cleanup is required.

Release() is idempotent. After release or manager shutdown, IsValid() returns false and new operations fail. If an operation already owns the context transaction, release prevents new operations while allowing the active transaction to finish before the SDK scene is destroyed.

Method details ​

IsValid ​

cpp
bool IsValid() const

Returns true while the active scene manager owns the represented scene. It returns false after Release() or manager shutdown.

SaveToFile ​

cpp
SG::FTaskResult<void> SaveToFile(const FString& InFilePath)

Saves the managed scene to InFilePath. This potentially long-running operation must be called off the game thread. Operations targeting the same context are serialized.

SaveToFileAsync ​

cpp
TFuture<SG::FTaskResult<void>> SaveToFileAsync(const FString& InFilePath)

Runs the save on a dedicated worker thread and returns its result through a future. The function may be called from any thread.

LoadFromFile ​

cpp
static SG::FTaskResult<TStrongObjectPtr<USimplygonSceneContext>> LoadFromFile(
    UObject* InOuter,
    const FString& InFilePath)

Loads a Simplygon scene file and creates a manager-owned context. This potentially long-running operation must be called off the game thread. Pass null for InOuter to use the transient package.

LoadFromFileAsync ​

cpp
static TFuture<SG::FTaskResult<TStrongObjectPtr<USimplygonSceneContext>>> LoadFromFileAsync(
    UObject* InOuter,
    const FString& InFilePath)

Loads a Simplygon scene file on a dedicated worker thread. The function may be called from any thread.

Release ​

cpp
void Release()

Unregisters the represented scene and releases its SDK resources once active work has drained. Repeated calls are safe. Do not start new operations with the context after release.