Skip to content

Simplygon Scene Manager for C++ ​

FSimplygonSceneManager owns process-wide managed Simplygon scenes and coordinates their lifetime, transactions, and serialized SDK access. Most editor workflows should use the Simplygon Subsystem. Native tools and builders can acquire the manager for direct scene operations.

For a complete workflow, see Managed Scene Export and Capture.

Ownership and concurrency ​

Always use Acquire() and retain the returned shared pointer for the complete operation. TryGet() returns a non-owning pointer and is only safe when the caller independently prevents manager teardown.

Operations targeting the same scene are serialized by a scene transaction. Transactions for different scenes may overlap, while individual Simplygon SDK scene accesses remain serialized. Shutdown rejects new operations, drains active operations and transactions, and releases all managed scenes before SDK teardown.

Methods ​

NameDescription
AcquireRetain shared ownership of the active manager.
TryGetRetrieve a non-owning manager pointer for externally synchronized code.
CreateSceneContextCreate an empty managed scene and context.
SaveSceneContextToFileSave the scene represented by a context.
SaveSceneContextToFileAsyncSave a context on a dedicated worker thread.
LoadSceneContextFromFileLoad a scene file into a managed context.
LoadSceneContextFromFileAsyncLoad a managed context on a dedicated worker thread.
RegisterSceneTransfer an existing SDK scene into manager ownership.
LoadSceneFromFileLoad and register a scene without creating a context.
SaveSceneToFileSave a scene by its managed identifier.
AccessSceneRun one serialized SDK scene access.
ExecuteSceneTransactionReserve a scene for a complete logical operation.
ExecuteComponentExportTransactionRun the one component-export attempt allowed for a scene.
GetSceneIDResolve and validate an opaque context.
ContainsCheck whether a scene is currently registered.
RemoveSceneUnregister a scene and release it after active work drains.
ShutdownStop new work, drain active work, and release every scene.

Method details ​

Acquire ​

cpp
static TSharedPtr<FSimplygonSceneManager, ESPMode::ThreadSafe> Acquire()

Returns shared ownership of the active manager, or null after shutdown begins. Retain the shared pointer until the complete manager call or sequence of calls has finished.

TryGet ​

cpp
static FSimplygonSceneManager* TryGet()

Returns a non-owning pointer, or null after shutdown begins.

WARNING

Prefer Acquire(). The global lookup lock does not keep a raw pointer alive after TryGet() returns. Only use this function when another mechanism guarantees that manager teardown cannot run concurrently.

CreateSceneContext ​

cpp
SG::FTaskResult<TStrongObjectPtr<USimplygonSceneContext>> CreateSceneContext(
    UObject* InOuter = nullptr)

Creates an empty managed SDK scene and its UObject context. The function may be called from any thread. Off the game thread, context construction is dispatched to the game thread and awaited. Pass null for InOuter to use the transient package.

SaveSceneContextToFile ​

cpp
SG::FTaskResult<void> SaveSceneContextToFile(
    USimplygonSceneContext* InContext,
    const FString& InFilePath)

SG::FTaskResult<void> SaveSceneContextToFile(
    USimplygonSceneContext* InContext,
    const FString& InFilePath,
    TFunctionRef<bool()> InCancelRequested)

Saves the scene represented by InContext. Call this potentially long-running operation off the game thread. The cancellation-aware overload polls while waiting for the scene transaction. Cancellation cannot interrupt the Simplygon SDK serializer after serialization begins.

SaveSceneContextToFileAsync ​

cpp
TFuture<SG::FTaskResult<void>> SaveSceneContextToFileAsync(
    USimplygonSceneContext* InContext,
    const FString& InFilePath)

Runs the context save on a dedicated worker thread.

LoadSceneContextFromFile ​

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

Loads a scene and creates its managed context. Call this potentially long-running operation off the game thread.

LoadSceneContextFromFileAsync ​

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

Loads a scene and creates its context on a dedicated worker thread.

RegisterScene ​

cpp
SG::FTaskResult<FGuid> RegisterScene(Simplygon::spScene InScene)

Transfers a non-null SDK scene into manager ownership and returns its managed identifier.

LoadSceneFromFile ​

cpp
SG::FTaskResult<FGuid> LoadSceneFromFile(const FString& InFilePath)

Loads a scene file, registers the scene, and returns its managed identifier.

SaveSceneToFile ​

cpp
SG::FTaskResult<void> SaveSceneToFile(
    const FGuid& InSceneID,
    const FString& InFilePath)

SG::FTaskResult<void> SaveSceneToFile(
    const FGuid& InSceneID,
    const FString& InFilePath,
    TFunctionRef<bool()> InCancelRequested)

Saves a registered scene. The cancellation-aware overload can stop while waiting for the scene transaction, but cannot interrupt the Simplygon SDK serializer after serialization begins.

AccessScene ​

cpp
SG::FTaskResult<void> AccessScene(
    const FGuid& InSceneID,
    TFunctionRef<SG::FTaskResult<void>(Simplygon::spScene)> InOperation)

Runs one callback with serialized access to the owned SDK scene. Keep the callback focused on SDK access and do not retain the spScene after the callback returns.

ExecuteSceneTransaction ​

cpp
SG::FTaskResult<void> ExecuteSceneTransaction(
    const FGuid& InSceneID,
    TFunctionRef<SG::FTaskResult<void>()> InOperation)

SG::FTaskResult<void> ExecuteSceneTransaction(
    const FGuid& InSceneID,
    TFunctionRef<bool()> InCancelRequested,
    TFunctionRef<SG::FTaskResult<void>()> InOperation)

Reserves one scene for a complete logical operation. The operation may call AccessScene() multiple times and perform non-SDK work between those calls. The cancellation-aware overload polls while waiting for the reservation and once more after acquiring it.

ExecuteComponentExportTransaction ​

cpp
SG::FTaskResult<void> ExecuteComponentExportTransaction(
    const FGuid& InSceneID,
    TFunctionRef<bool()> InCancelRequested,
    TFunctionRef<SG::FTaskResult<void>(Simplygon::spScene)> InOperation)

Runs the one component-export attempt allowed for a managed scene. Once the transaction begins, the attempt is consumed even if the operation fails or is canceled because partial SDK changes may remain.

GetSceneID ​

cpp
SG::FTaskResult<FGuid> GetSceneID(const USimplygonSceneContext* InContext) const

Resolves the private identifier of a valid context. The call fails for null, destroyed, released, or stale contexts.

Contains ​

cpp
bool Contains(const FGuid& InSceneID) const

Returns true while the manager owns the scene and it is not pending removal.

RemoveScene ​

cpp
void RemoveScene(const FGuid& InSceneID)

Unregisters the scene. New lookups fail immediately. If a transaction already owns the scene, SDK destruction is deferred until that transaction completes. Repeated calls are safe.

Shutdown ​

cpp
void Shutdown()

Stops accepting new operations, clears the process-wide lookup, drains active operations and transactions, and releases all managed scenes before Simplygon SDK teardown.