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
| Name | Description |
|---|---|
| Acquire | Retain shared ownership of the active manager. |
| TryGet | Retrieve a non-owning manager pointer for externally synchronized code. |
| CreateSceneContext | Create an empty managed scene and context. |
| SaveSceneContextToFile | Save the scene represented by a context. |
| SaveSceneContextToFileAsync | Save a context on a dedicated worker thread. |
| LoadSceneContextFromFile | Load a scene file into a managed context. |
| LoadSceneContextFromFileAsync | Load a managed context on a dedicated worker thread. |
| RegisterScene | Transfer an existing SDK scene into manager ownership. |
| LoadSceneFromFile | Load and register a scene without creating a context. |
| SaveSceneToFile | Save a scene by its managed identifier. |
| AccessScene | Run one serialized SDK scene access. |
| ExecuteSceneTransaction | Reserve a scene for a complete logical operation. |
| ExecuteComponentExportTransaction | Run the one component-export attempt allowed for a scene. |
| GetSceneID | Resolve and validate an opaque context. |
| Contains | Check whether a scene is currently registered. |
| RemoveScene | Unregister a scene and release it after active work drains. |
| Shutdown | Stop new work, drain active work, and release every scene. |
Method details
Acquire
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
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
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
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
TFuture<SG::FTaskResult<void>> SaveSceneContextToFileAsync(
USimplygonSceneContext* InContext,
const FString& InFilePath)Runs the context save on a dedicated worker thread.
LoadSceneContextFromFile
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
TFuture<SG::FTaskResult<TStrongObjectPtr<USimplygonSceneContext>>> LoadSceneContextFromFileAsync(
UObject* InOuter,
const FString& InFilePath)Loads a scene and creates its context on a dedicated worker thread.
RegisterScene
SG::FTaskResult<FGuid> RegisterScene(Simplygon::spScene InScene)Transfers a non-null SDK scene into manager ownership and returns its managed identifier.
LoadSceneFromFile
SG::FTaskResult<FGuid> LoadSceneFromFile(const FString& InFilePath)Loads a scene file, registers the scene, and returns its managed identifier.
SaveSceneToFile
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
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
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
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
SG::FTaskResult<FGuid> GetSceneID(const USimplygonSceneContext* InContext) constResolves the private identifier of a valid context. The call fails for null, destroyed, released, or stale contexts.
Contains
bool Contains(const FGuid& InSceneID) constReturns true while the manager owns the scene and it is not pending removal.
RemoveScene
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
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.
