Documentation Index
Fetch the complete documentation index at: https://docs-unity.molca.id/llms.txt
Use this file to discover all available pages before exploring further.
Product: Molca VR SDK (molca-sdk-vr). DT apps do not use this flow.
This page is a linear checklist for a new simulation scenario. Tour scenarios follow the same data → scene → registry pattern; see the Tour section and Tour subsystem.
Prerequisites
1. Create simulation scenario data
- Project window → Create → MolcaSDK → Scenario → Simulation Scenario Data (or equivalent menu for
SimulationScenarioData).
- Name the asset (e.g.
Scenario_MyTraining).
- In the Inspector, set:
- Ref Id — stable id (auto-generated if empty).
- Scenario name / description / tags / image — Home UI and metadata (
DynamicLocalization entries are initialized from RefId in BaseScenarioData.Initialize()).
- Time limit —
Time Limit Seconds; 0 = no limit.
- Scenario Activities — add
ScenarioActivityData entries (each has Ref Id, titles, Activity Id / slug fields as defined on the type). These are the authoring records the runtime ScenarioActivity will match.
- Scene loading — configure the
SceneLoadPlan for your scenario:
- Single Player Plan — expand
Single Player Plan in the Inspector:
- Scenario Scene — the main scenario logic scene (required). Set either
Scene Name (build settings) or Scene Reference (Addressable — takes priority).
- Preload Scenes — optional scenes loaded before the scenario scene (e.g., shared environment). Index 0 loads as Single (active scene); subsequent entries load Additive. Each entry can specify
Wait For Ref Ids to pause loading until those RefIds are registered in ReferenceManager.
- Role Scene Mappings — for multiplayer scenarios, configure per-role scene plans. Each mapping has a
Role Id (matching a ScenarioRole.RefId) and its own SceneLoadPlan.
Load order: When preloads exist, preloadScenes[0] loads as Single, subsequent preloads as Additive (waiting for RefIds between each), then scenarioScene as Additive. When no preloads, scenarioScene loads as Single.
Confirm the scene names or Addressable keys match your Unity scenes exactly.
2. Create and lay out the scenario scene
- Create or open the Unity scene referenced by the scenario asset.
- Add the
[VR Scenario] prefab (typical path: Assets/_MolcaSDK/_VR/Prefabs/Base/) — includes XR rig, scenario UI shell, and related objects (your project layout may vary).
- Select
ScenarioManager on the prefab (or your scene root).
ScenarioManager (in scene)
| Field | Action |
|---|
| Scenario Data | Assign your SimulationScenarioData asset. |
| Auto Start | Enable for immediate start on load; disable if you start from script. |
| Activities | Assign in step 3 (ordered list of ScenarioActivity components). |
| Start All Activities Simultaneously | Parallel vs first-only sequential behavior. |
| Is Direct Complete When All Activity Complete | Auto-finish scenario when every activity completes. |
| Use Session Manager | Enable for connected session flows. |
| Pause Modal / Pause Input | Wire pause UX. |
See Scenario manager for state and timing notes.
3. Create activities in the scene
For each ScenarioActivityData on the asset:
- Create a GameObject (e.g. under an
Activities parent).
- Add
ScenarioActivity — Unity adds SequenceController automatically ([RequireComponent]).
- Set
Activity Id on ScenarioActivity to the same string as that row’s ScenarioActivityData.RefId. At runtime, the component resolves ActivityData with FirstOrDefault(a => a.RefId == activityId); a mismatch logs a warning and breaks Home/session metadata binding.
- Configure
autoAdvanceToNext if you want automatic progression to the next activity when the sequence completes.
- Drag each activity GameObject into
ScenarioManager.Activities in the intended order (unless you rely entirely on simultaneous start — then order still matters for UI/progression).
4. Add steps under each activity
- Under each activity object, add child GameObjects and attach Step components (Grab, Valve, etc.).
SequenceController discovers Step children and runs them in hierarchy order; use ParallelStep or bridges when you need non-linear flow.
- Wire SceneObjectReference / interactables: put ReferenceableComponent on targets and point steps at those Ref Ids.
- Optional: Auxiliaries on each step (scoring, haptics, controller hints — VR step auxiliaries).
Use Sequence Visualizer in the Unity Editor to inspect the tree, change step type, or open the CSV Step Importer.
5. Scoring (optional)
ScenarioScoring on the ScenarioManager object (or as your prefab dictates).
ActivityScoring per ScenarioActivity.
StepScoringAuxiliary on steps that contribute points.
Details: ScoringConfig and related pages.
6. Register in ScenarioDataConfig
- Open the
ScenarioDataConfig SettingModule.
- Under Scenario Collections, add or extend a collection.
- Add your
SimulationScenarioData asset to the list so Home UI can list it (and so org/content flows can resolve it when connected).
7. Test
| Goal | Suggestion |
|---|
| Fast iteration | Disable Use Session Manager on ScenarioManager, enter Play Mode from the scenario scene with Auto Start on. |
| Full flow | Run Preload → Auth → Home, pick the scenario, and confirm session loading + scene name / Addressables match. |
Scene loading details
SceneLoadPlan structure
The SceneLoadPlan supports ordered multi-scene loading with synchronization:
| Field | Purpose |
|---|
| Preload Scenes | Array of scenes loaded before the scenario scene (e.g., shared environment, lighting). Index 0 loads as Single (active scene); subsequent entries load Additive. |
| Scenario Scene | The main scenario logic scene. Loads Additive when preloads exist, Single when no preloads. |
SceneEntry fields
Each scene entry (preload or scenario) has:
| Field | Purpose |
|---|
| Scene Name | Build-settings scene name. Used when Scene Reference is not set. |
| Scene Reference | Addressable AssetReference. Takes priority over Scene Name when valid. |
| Wait For Ref Ids | Array of RefIds that must be registered in ReferenceManager before the next scene loads. Leave empty to wait two frames only. Timeout: 15 seconds. |
Load order example
Configuration:
singlePlayerPlan:
preloadScenes:
[0] sceneName: "Environment_Factory"
waitForRefIds: ["factory_floor", "control_panel"]
[1] sceneName: "Lighting_Day"
waitForRefIds: []
scenarioScene:
sceneName: "Scenario_SafetyTraining"
Execution:
- Load “Environment_Factory” as Single (active scene)
- Wait for “factory_floor” and “control_panel” RefIds (or 15s timeout)
- Load “Lighting_Day” as Additive
- Wait two frames (no RefIds specified)
- Load “Scenario_SafetyTraining” as Additive
Multiplayer role scenes
For multiplayer scenarios, configure roleSceneMappings:
roleSceneMappings:
[0] roleId: "operator"
plan:
preloadScenes: [shared environment]
scenarioScene: "Operator_View"
[1] roleId: "supervisor"
plan:
preloadScenes: [shared environment]
scenarioScene: "Supervisor_View"
At runtime, ScenarioData.GetSceneLoadPlan(playerMode, roleId) returns the appropriate plan. The SceneLoadPlanExecutor (used by ScenarioSessionManager) handles the ordered loading and RefId synchronization.
Tour variant (short path)
- Create
TourScenarioData (Create → MolcaSDK → Scenario → Tour Scenario Data).
- Fill metadata, spots, materials, and scene reference like the simulation asset.
- Open the tour scene; use
[VR Tour] from Assets/_MolcaSDK/_VR/Prefabs/Tour/ or [VR Scenario] with TourScenarioData assigned — mode driver selects tour behavior.
- Place
TourAreaManager, TourSpotController, etc., per your content (Tour area and spots).
- Runtime prefab must include
TourSubsystem when using tour + session flows.
- Register the asset in ScenarioDataConfig as above.
Unity Editor