Runtime Scene Loading
There are two ways to get a SuperDex scene into Unreal. You can import it in the editor, so
that the level's own actors and components are the physics scene, or you can load a scene file
at runtime, so that a .superdex_scene file is the physics scene and Unreal mirrors it. Both
can drive demos and data collection; they trade off differently.
| Editor-authored level | Runtime scene file | |
|---|---|---|
| Source of truth | Unreal assets and the level | The .superdex_scene or .superdex_scene_archive file |
| Changing the scene | Edit the level; reimport after Studio changes | Point the build at another file. Its physics and generic visuals need no re-cook; Blueprints, levels, and hooks it relies on must already be in the build |
| Unreal-side tuning | Every component and settings asset is editable | Gravity, solver, and contact layers come from the file |
| Visuals | Imported meshes and materials, full Unreal lighting | Built at runtime from the file's render models (.glb) or collision shapes |
| Bots, controllers, sensors | The scene importer places each bot with a SuperDexBotComponent; it skips the file's controllers and scene sensors (add controllers in Unreal) | The native loader declares the file's bots, controllers included, but creates none until your code calls BotScene::InitializeBot |
| Same physics as Python and Studio | As close as the importers allow (see their limits) | Loaded by the same native SuperDex Robotics loader |
| Ready-made support in the plugins | Example levels, Player Start, roboperators | Loader, visualization, hooks, and the L_RuntimeSceneLoad example to start from |
How runtime loading works
USuperDexBotSceneSubsystem (a game-instance subsystem in SuperDexRobotics) owns the load. It
reads the scene path from the command line when the game instance starts, before any actor's
Begin Play:
SuperDexUnreal.exe -SuperDexSceneFile="C:\scenes\my_scene.superdex_scene_archive"
Use an absolute path; Unreal resolves a relative one against its own base directory, not the shell's working directory. The subsystem then:
- Claims the game instance's SuperDex Physics scene for the file. From then on Unreal components create no simulated actors in it, and level settings (gravity, solver params, contact layers) no longer apply; only step params and debug draw do.
- Fails if the physics scene already holds actors: the file must be the only source of physics actors.
- Populates the scene from the file and reports its state through
GetState():Disabled(no scene requested),Loaded, orFailed.Failedis terminal: the session does not quietly fall back to level physics, even when the request fails before loading, as with an empty-SuperDexSceneFile=path or a-SuperDexTaskFolder=that holds no tasks. The reason is in the log, prefixedSuperDexBotSceneSubsystem:.
Without -SuperDexSceneFile=, the subsystem stays Disabled and levels simulate their own
components as usual.
Seeing the scene
USuperDexBotSceneVisualizationComponent mirrors the loaded scene into the level: base-scene
actors, spawned prefabs, and bot links, updated every frame. Add it to any actor in the level
you run; it never loads a scene itself, and builds whenever the subsystem reports a load. Entries
with a render model (.glb) are drawn with it, imported at runtime; the others, and every entry
under -NoRenderModels, are drawn from their collision shapes. Rods are drawn from their visual mesh
or contact skin; a rod with neither is visible only in SuperDex Physics debug draw.
Driving the scene's bots
The loader declares the scene's bots but does not create them, because only your project knows which of the offered bots it drives. That step, and binding Unreal to the result, is C++; the Runtime Scene Load example does both:
-
USuperDexBotSceneSubsystem::GetBotScene()returns the nativeBotScene; create the bots you use withBotScene::InitializeBot. The scene steps on its own thread, so make that call through the Mochi scene'sQueueOrExecuteCommand, wait withWaitForQueuedCommands(), and check each result before using it. Then, back on the game thread, callNotifySceneContentsChanged()so the visualization rebuilds:UGameInstance* GameInstance = GetGameInstance();
USuperDexBotSceneSubsystem* Subsystem = GameInstance->GetSubsystem<USuperDexBotSceneSubsystem>();
superdex::robotics::BotScene* BotScene = Subsystem->GetBotScene();
UMochiSceneObject* SceneObject =
GameInstance->GetSubsystem<UMochiGameInstanceSubsystem>()->GetScene();
superdex::robotics::Bot* Bot = nullptr;
superdex::Error Error;
SceneObject->QueueOrExecuteCommand([&](mochi::Scene*) {
Bot = BotScene->InitializeBot("my_bot", Error);
});
SceneObject->WaitForQueuedCommands();
if (!Bot) {
UE_LOG(LogTemp, Error, TEXT("InitializeBot failed: %s"),
UTF8_TO_TCHAR(Error.ToString().c_str()));
return;
}
Subsystem->NotifySceneContentsChanged(); -
USuperDexBotComponent::BindToExistingBotlets a level's bot component, such as the one in a roboperator, pose its skeletal mesh from a scene-owned bot instead of creating its own.bHideMeshWhenBoundToSceneBot(on by default) leaves drawing to the visualization. -
USuperDexBotSceneSubsystem::EnsureLoadedloads a fallback path when the command line gave none, for editor iteration. Call it before any actor's Begin Play, for example from an actor'sPostInitializeComponents.
These hooks are not exposed to Blueprint. While a scene file owns the physics scene, a
level-authored bot component that is not bound creates no bot of its own. The scene's slots and
each bot's roboperatorClass tell your code which bots to offer and which rig drives each; see
Slots and roboperators.
The Runtime Scene Load Example
/SuperDexExamples/RuntimeSceneLoad/L_RuntimeSceneLoad builds its workcell at runtime from a
scene file instead of from actors placed in the level. It loads
assets/scenes/runtime_scene_load/runtime_scene_load.superdex_scene, a SuperDex scene modeled on
L_Sampler that differs from it in a few places: the workbench as its base scene, the arms and
proxy hands in left and right slots, seven of L_Sampler's prefabs as spawnable prefabs, and
one task per prefab in its tasks/ folder. The level adds the lighting, the player setup,
keyboard overlay, and FPS/SPS counter, and one ASuperDexRuntimeSceneLoadExample actor (in the
SuperDexTeleop module) that does the C++ work above:
- Loads the scene through the subsystem and draws it.
- Brings up each slot's selected bot (the slot's first, at first) and spawns the roboperator from
its Roboperators list whose class the bot names in
roboperatorClass, at the bot's base and bound to the scene bot. - Before every physics step, drives the bot's scene controllers from what that roboperator's
TeleopNode last published: a
Posecontroller takes the arm pose target, aJointPositionscontroller the joint targets, and aMOCHI_ARTICULATED_POSEcontroller follows the tracked hand. Other controllers are not driven. - Spawns the current task's objects, steps through a task folder, and resets the objects. Each episode puts the bots back in the poses the scene first brought them up in.
- On Win64, records each episode with SuperDex Recorder when Record is on or
-SuperDexRecordis passed. Each recording references the loaded scene and task files by name and content hash.
Any scene whose bots name roboperators in that list runs with its own bots, prefabs, and
controllers. The example is a starting point, not a framework: one actor in
SuperDexTeleop/Public/Examples/SuperDexRuntimeSceneLoadExample.h and its .cpp, to copy into your
own module and change.

Settings and controls
The actor's properties are in the SuperDex Robotics → Runtime Scene Load category, which the Details panel shows first:
| Property | Purpose |
|---|---|
| Scene File | The scene, relative to the project directory. -SuperDexSceneFile= overrides it. |
| Task File | A .superdex_task, or a folder whose tasks play in name order, relative to the project directory. -SuperDexTaskFolder= or -SuperDexTaskFile= on the command line of the editor or a packaged executable overrides it. |
| Roboperators | The roboperator classes the scene's bots name in roboperatorClass. |
| Slots | Per scene slot: its Name, the Handedness of the hand that drives it, and its Cycle Bot Key. |
| Record, Recording Directory, Record Contact Forces | Recording on Win64. -SuperDexRecord, -SuperDexRecordDir=, and -SuperDexRecordContacts override them; the directory defaults to <Project>/Saved/SuperDexRecorder. |
In L_RuntimeSceneLoad, Scene File and Task File point two folders above the project, at the
repository's assets/scenes/runtime_scene_load/, and Record is on. The keys follow
L_Sampler, and the level's keyboard overlay lists them:
| Key | Action |
|---|---|
| Ctrl+A / Alt+A | Next bot in the left / right slot. |
| B / N | Previous / next task. |
| M | Reset the task's objects. |
| Space | Clutch the roboperators, as in L_Sampler. |
| Enter | Start recording an episode, or keep the one recording and start the next. |
| Backspace | Discard the episode being recorded and start the next. |
Changing a slot's bot or the recording state restarts the episode. Each key is a property of the actor, and each action is
also a Blueprint-callable function (CycleSlotBot, NextTask, ResetTask, RecordOrKeep, and
so on).

Running the example in a packaged build
A packaged build has no repository beside it, so pass both paths as absolute paths:
SuperDexUnreal.exe /SuperDexExamples/RuntimeSceneLoad/L_RuntimeSceneLoad -SuperDexSceneFile="C:\project_superdex\assets\scenes\runtime_scene_load\runtime_scene_load.superdex_scene" -SuperDexTaskFolder="C:\project_superdex\assets\scenes\runtime_scene_load\tasks"
The scene's README
lists its tasks and where it differs from L_Sampler.
Producing a scene file
For what a scene file holds, see SuperDex Scenes.
- SuperDex Studio authors
.superdex_scenefiles and exports archives in its Scene Editor. - From a running level, the Blueprint node
ExportSuperDexBotScene(inSuperDexRoboticsFunctionLibrary) writes the current physics scene to<OutputDir>.superdex_scene_archive, with actors in their current pose and bots as bot archives. It works in the editor and Play In Editor only. SetbCaptureLiveSceneto capture the scene exactly as it is.
Tasks and Repeated Episodes
Pass -SuperDexTaskFile="C:\tasks\trial.superdex_task" to parse a task
alongside the scene, or -SuperDexTaskFolder="C:\tasks" to select the first
task in a folder's filename-sorted playlist. The folder takes precedence when
both switches are supplied. Task files are separate from scene archives.
The subsystem holds the task but does not apply its reset state. Your C++ host resolves placements and any randomization, calls SpawnTaskInstance for the required objects, then NotifySceneContentsChanged once after the batch so visualization rebuilds. DestroyAllTaskInstances removes those objects; AdvanceToNextTask changes the parsed task without replacing the scene or its bots. The host still owns robot/controller reset, episode timing, and recording boundaries. See Bot Tasks for the format and outcome semantics.
Packaging
The project cooks the maps listed in Config/DefaultGame.ini (MapsToCook), which include
L_RuntimeSceneLoad; add the level you run to that list. Scene files are read from disk at
runtime, so they are not cooked: ship them next to the build, or anywhere -SuperDexSceneFile=
can reach. The same file also always cooks /InterchangeAssets/gltf, Unreal's stock glTF
materials, which the render models imported at runtime instance; a project of your own that draws
.glb render models at runtime needs that entry too.
Runtime scene loading is supported on Windows only. It is not supported in the experimental
Meta Quest standalone build, even though L_RuntimeSceneLoad is cooked into that package.
Recording a runtime-loaded scene needs SuperDex Recorder, which is also Win64-only. For the
Windows build steps, see the
SuperDex Unreal README.
See Also
- Tutorial: Load a Scene File at Runtime
- SuperDex Scenes — the
.superdex_sceneformat, slots, and archives. - Physics in Unreal — importers, settings, and components for the editor path.