Skip to main content

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

  1. Project window → Create → MolcaSDK → Scenario → Simulation Scenario Data (or equivalent menu for SimulationScenarioData).
  2. Name the asset (e.g. Scenario_MyTraining).
  3. 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 limitTime Limit Seconds; 0 = no limit.
  4. 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.
  5. 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

  1. Create or open the Unity scene referenced by the scenario asset.
  2. 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).
  3. Select ScenarioManager on the prefab (or your scene root).

ScenarioManager (in scene)

FieldAction
Scenario DataAssign your SimulationScenarioData asset.
Auto StartEnable for immediate start on load; disable if you start from script.
ActivitiesAssign in step 3 (ordered list of ScenarioActivity components).
Start All Activities SimultaneouslyParallel vs first-only sequential behavior.
Is Direct Complete When All Activity CompleteAuto-finish scenario when every activity completes.
Use Session ManagerEnable for connected session flows.
Pause Modal / Pause InputWire pause UX.
See Scenario manager for state and timing notes.

3. Create activities in the scene

For each ScenarioActivityData on the asset:
  1. Create a GameObject (e.g. under an Activities parent).
  2. Add ScenarioActivity — Unity adds SequenceController automatically ([RequireComponent]).
  3. 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.
  4. Configure autoAdvanceToNext if you want automatic progression to the next activity when the sequence completes.
  5. 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

  1. Under each activity object, add child GameObjects and attach Step components (Grab, Valve, etc.).
  2. SequenceController discovers Step children and runs them in hierarchy order; use ParallelStep or bridges when you need non-linear flow.
  3. Wire SceneObjectReference / interactables: put ReferenceableComponent on targets and point steps at those Ref Ids.
  4. 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)

  1. ScenarioScoring on the ScenarioManager object (or as your prefab dictates).
  2. ActivityScoring per ScenarioActivity.
  3. StepScoringAuxiliary on steps that contribute points.
Details: ScoringConfig and related pages.

6. Register in ScenarioDataConfig

  1. Open the ScenarioDataConfig SettingModule.
  2. Under Scenario Collections, add or extend a collection.
  3. 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

GoalSuggestion
Fast iterationDisable Use Session Manager on ScenarioManager, enter Play Mode from the scenario scene with Auto Start on.
Full flowRun 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:
FieldPurpose
Preload ScenesArray of scenes loaded before the scenario scene (e.g., shared environment, lighting). Index 0 loads as Single (active scene); subsequent entries load Additive.
Scenario SceneThe main scenario logic scene. Loads Additive when preloads exist, Single when no preloads.

SceneEntry fields

Each scene entry (preload or scenario) has:
FieldPurpose
Scene NameBuild-settings scene name. Used when Scene Reference is not set.
Scene ReferenceAddressable AssetReference. Takes priority over Scene Name when valid.
Wait For Ref IdsArray 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:
  1. Load “Environment_Factory” as Single (active scene)
  2. Wait for “factory_floor” and “control_panel” RefIds (or 15s timeout)
  3. Load “Lighting_Day” as Additive
  4. Wait two frames (no RefIds specified)
  5. 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)

  1. Create TourScenarioData (Create → MolcaSDK → Scenario → Tour Scenario Data).
  2. Fill metadata, spots, materials, and scene reference like the simulation asset.
  3. Open the tour scene; use [VR Tour] from Assets/_MolcaSDK/_VR/Prefabs/Tour/ or [VR Scenario] with TourScenarioData assigned — mode driver selects tour behavior.
  4. Place TourAreaManager, TourSpotController, etc., per your content (Tour area and spots).
  5. Runtime prefab must include TourSubsystem when using tour + session flows.
  6. Register the asset in ScenarioDataConfig as above.

Unity Editor

New Scenario Quickstart Editor