LUIDA Docs
ComponentsUnity templateEditor windows

GameObject › LUIDA menu

Insert LUIDA-aware prefabs (Data Collector, Questionnaire) into the active scene with one click.

These pages are not yet fully reviewed. The LUIDA team is continuing to review and improve them. If you find anything wrong on these pages, or have questions that aren't resolved by reading them, please ask or report to the LUIDA team.

The GameObject › LUIDA sub-menu adds LUIDA-aware prefabs to the currently-open scene in a single click. Each entry is essentially "drag this prefab from the package folder into the scene and hook up the right scripts" — automated, so you don't have to remember the prefab paths or the auxiliary wiring.

This menu is the standard way to add LUIDA runtime prefabs to a scene. Using it (versus dragging prefabs by hand) guarantees the auxiliary assets — per-scene data calculator scripts, condition-manager references — get created and wired up correctly.

The menu entries

GameObject › LUIDA › Data Collector

Inserts the LUIDA-DataCollector prefab into the active scene and ensures everything around it is wired up. This is one of two entry points for setting up data collection — the other is the dedicated Configure data collector window, which can also create the same prefab from inside its builder UI.

What it does, step by step:

  1. Checks that no LuidaDataCollector already exists in the scene (only one allowed). If one does, shows an error and stops.
  2. Instantiates the LUIDA-DataCollector prefab from Assets/ClusterMetaverseLab/LuidaExpTemplate/Runtime/Prefabs/CustomDataCollection/LUIDA-DataCollector.prefab. The instance is renamed to LUIDA-DataCollector in the scene hierarchy.
  3. Finds or creates a per-scene data-calculator script at Assets/_Experiment_/Scripts/DataCollectors/<SceneName>.js. The script body is generated by the Configure data collector window from the per-scene LuidaDataCollectorConfig asset; if no config exists yet, the menu creates an empty one.
  4. Assigns the script to the new LuidaDataCollector component's Script Asset field, so when ProcessAndSaveCollectedData() fires at runtime, the right calculator runs.
  5. Ensures the scene has access to the ConditionManager (the LUIDA-ExpManagers prefab usually provides it; if missing, the menu adds it).
  6. Selects the new GameObject in the Hierarchy so you can immediately adjust its position.

Use this menu entry once per scene that needs to log custom data. The complete data-collection pipeline is:

  • Push data — write (label, value) pairs into the scratchpad. Either via the SendDataToCollector action ("Push data to collector" in the editor) or by attaching a Luida Data Collection Gimmick to a CCK trigger with its Push data phase enabled.
  • Save pushed data — snapshot the scratchpad into one queued row. Action: ProcessAndSaveCollectedData ("Save pushed data in collector"), or the gimmick's Save pushed data phase.
  • Upload saved data — flush the queue to the Web Console via callExternal. Action: UploadCollectedData ("Upload saved data from collector"), or the gimmick's Upload saved data phase.

The merged LuidaDataCollectionGimmick lets you enable any combination of the three phases on one component, so a single trigger can push-and-save in one step (or push-save-upload as a one-shot).

Edit the per-scene calculator visually through LUIDA › Configure data collector. That window owns the calculator schema (Section A: collected labels; Section B: field definitions) and regenerates Assets/_Experiment_/Scripts/DataCollectors/<SceneName>.js whenever you save. Hand-editing the .js file works for one-off tweaks, but the next save from the window will overwrite it. See Configure data collector for the window walkthrough.

GameObject › LUIDA › Questionnaire

Inserts a Questionnaire prefab into the active scene, ready to bind to a Web Console qID.

What it does:

  1. Opens a small dialog asking for the questionnaire's qID (the 1-based index from the Web Console's questionnaire list for this experiment).
  2. Instantiates the Questionnaire prefab from the template package and configures its qID field.
  3. The prefab carries a LuidaQuestionnaire component which subscribes to state-machine qID events: when a state with the matching qID becomes active, the prefab renders the questionnaire UI in front of the participant; when answered (or skipped), it dispatches answers to the Web Console.
  4. The prefab is parented under the scene root and selected in the Hierarchy.

Insert one Questionnaire prefab per questionnaire you want to display. The Web Console questionnaire builder defines the questions and their qID; the Unity prefab is just the in-world renderer.

For more on qID binding, see Concepts → Questionnaires.

Screenshot pending — the GameObject › LUIDA › Questionnaire menu, plus the qID input dialog set to 2, plus the resulting Questionnaire prefab in the Hierarchy.

What lives where

The prefabs the menu inserts come from:

Assets/ClusterMetaverseLab/LuidaExpTemplate/Runtime/Prefabs/
├── LUIDA-ExpManagers.prefab                              ← session manager (already in template scenes)
├── CustomDataCollection/LUIDA-DataCollector.prefab       ← inserted by Data Collector menu
├── ConditionManagement/ConditionManager.prefab           ← auto-added by Data Collector menu if missing
└── Questionnaire/Questionnaire.prefab                    ← inserted by Questionnaire menu

The per-scene assets the menus generate end up under Assets/_Experiment_/:

Assets/_Experiment_/Scripts/DataCollectors/<SceneName>.js   ← created by Data Collector menu

You can edit the calculator script freely; the prefab in the scene retains its reference to it.

Why use the menu instead of dragging prefabs

You can drag the prefabs from the Project panel into a scene manually, but you'll have to:

  • Manually create the per-scene calculator script.
  • Manually assign it to the LuidaDataCollector's Script Asset field.
  • Manually verify ConditionManager is present in the scene hierarchy.
  • (For Questionnaires) manually set the qID on the prefab instance.

The menu does all of that in one click and prevents the most common omission — forgetting to wire the calculator script — which would result in ProcessAndSaveCollectedData() having nothing to process at runtime.

Common pitfalls

  • Trying to add a second Data Collector to the same scene. The menu refuses, by design. One Data Collector serves all custom-data logging in the scene; the calculator script is where you branch by condition or event type.
  • qID not matching the Web Console list. Off-by-one is the most common mistake — the Web Console is 1-indexed, so the first questionnaire you registered is qID = 1. Verify by opening the experiment detail page and counting from the top.
  • Editing the calculator template directly. CustomDataCalculatorTemplate.js is in the package folder; if you edit it, your changes get overwritten when you upgrade LUIDA. Always edit the per-scene copy at Assets/_Experiment_/Scripts/DataCollectors/<SceneName>.js.

Where to go next