> For the complete documentation index, see [llms.txt](https://help.imotions.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.imotions.com/lab/study-setup-and-design/virtual-reality/how-to-set-up-and-conduct-a-vr-study-with-screen-recording-in-unity-and-imotions.md).

# How to: Set up and conduct a VR Study with Screen Recording in Unity and iMotions

Create a VR Unity study in iMotions Lab, calibrate eye tracking in Varjo, HTC Vive or Vive Pro Eye headsets, and record the screen with gaze data.

The article will focus on how to conduct an iMotions study using HMDs with integrated Eye Tracking technology.

{% hint style="danger" %}
**Important note**

Please make sure your computer's region settings are set to US English, or at least that your dot-comma settings coincide with US English rules.
{% endhint %}

## \[1] Set up your VR hardware

The prerequisites to this article are that you already own a Unity Environment compatible with a VR headset that contains eye tracking from one of the following sources:

* Tobii Pro HTC Vive - [Unity, driver and setup guide](https://help.imotions.com/lab/study-setup-and-design/virtual-reality/htc-vive-pro-eye/htc-vive-1st-generation-unity-and-eye-tracking-configuration-in-imotions.md)
* Varjo VR-1 - [Driver and setup guide](https://support.varjo.com/hc/en-us/setting-up-vr-2-pro-vr-2-and-vr-1)
* HTC Vive Pro Eye - [Driver and setup guide](https://www.vive.com/eu/support/vive-pro-eye/category_howto/setting-up-for-the-first-time.html)

## \[2] Create an iMotions study for VR Eye Tracking

### 2.1 Global Settings

1. In iMotions, click "*Preferences*" > "*Global Settings*", and open the tab "*Eye Tracking*". Enable the checkbox "**Eye Tracking Server**", and select the correct HMD with Eye Tracking. Under "**Host Address**", enter the IP address and port from Unity. By default, it should be **127.0.0.1:4050**. You can click the button "*Test Connection*", which should return "**Connection OK**" if everything is set up correctly. ![The Eye tracking tab of Global Settings with Varjo VR selected](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-3231a282c20257a972c82749e0847bfbb801a161%2Flab_global-settings_eye-tracking_varjo-vr.png?alt=media)
2. Then, select the tab "*Stimuli*". Increase the **Capture Rate (fps)** to **30 fps** in order to accomplish higher temporal resolution for the screen recording. Please note that this will increase the CPU load of iMotions. Then click "**OK**" to close Global Settings. ![The Stimuli tab of Global Settings with the capture rate at 30 fps](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-2d33b040a5fb34b8d6bea37815879585ee9c3b70%2Flab_global-settings_stimuli_screen-recording.png?alt=media)

### 2.2 Study Setup

1. In the study library, click the plus (+) button.

   ![The Library with the Add Study button marked](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-018a178169c4e81aa0e267019faabaeb649773c5%2Flab_library_header_add-study.png?alt=media)
2. Select Virtual Reality (VR) button and click "Next".

   ![The study wizard with Virtual Reality (VR) selected as the study type](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-b0471081753e471fd5bcff85e59d2b5e0da1eebe%2Flab_study-wizard_study-type_vr.png?alt=media)
3. Select the "Unity" button as shown in the image below. Click "Next".

   ![The Select VR type page of the study wizard with Unity selected](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-27ad5aeb82f79c2b5f99f7f330b92ed2b5b00e07%2Flab_study-wizard_vr-type_unity.png?alt=media)

   If your study involves 360 degree stimuli (pictures / images), and you're using the HTC Vive Pro Eye, please follow this [LINK](https://help.imotions.com/lab/study-setup-and-design/virtual-reality/how-to-vr-360-vive-stimuli-study-setup.md). If your study involves interactive VR environments rendered in Unity, please continue here.
4. In the Sensors section,
   1. select your VR device with eye-tracking in the drop down menu (the supported eye tracking devices for VR are: Varjo Aero, Varjo VR and XR, HTC VIVE Pro Eye, or Tobii HTC Vive).
   2. select the API button c. to use also sensors such as GSR, ECG, Respiration, click the corresponding options shown in the image below (i.e. B-Alert, ActiCHamp, Biopac, Bluetooth Low Energy, Emotiv Cortex, Lab Streaming Layer, Shimmer):

      ![The Select sensors page of the study wizard with the eye tracker list open](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-66e7792cb275ca89aa997598b89af27fb18a1af0%2Flab_study-wizard_sensors_vr-unity-eye-tracker-list.png?alt=media)
5. Name your VR study. Click "Create study".

   ![The last page of the study wizard, where the study is named](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-dda4e9bc512c35adfd4dfafd66e979a1d7a70e55%2Flab_study-wizard_name-study.png?alt=media)
6. As a result of that, you will visualize this:

   ![A new Unity VR study in the Library, with its screen recording stimulus](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-6cd571ad34ffef0b455cab62aa1c47e2327efed5%2Flab_library_study-settings_vr-unity.png?alt=media)
7. Add a respondent by using the plus (+) button in the Respondent Bar.

   ![The form for adding a respondent](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-2f5171429d3724ca4129131d8b1f93e0db2f697e%2Flab_respondents_add-respondent-form.png?alt=media)

## \[3] Data Collection

The procedure for starting a VR study in iMotions is different than any other type of study. Normally you would connect to your eye tracker prior to starting the stimulus application you want to record. The process mentioned below is for a study without additional sensors, such as EEG, GSR, or ECG.

In a VR study, you will need to do the following:

1. Start the Unity Executable (Build Project).

   ![vr\_setup\_7.png](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-327fa437e8112e39f45af89d0c9c47dd0cf0398d%2F5afc8bd762_vr_setup_7.webp?alt=media)
2. Make sure the VR application is running with the same resolution as set in iMotions.

   ![vr\_setup\_8.png](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-664b7616c6fe50b715ba09dcce1d1893576471d3%2F4ae4a63103_vr_setup_8.webp?alt=media)
3. Calibrate the eye tracker - Note that the process here is slightly different for each HMD, 1.
   * **Tobii Pro HTC Vive**. Press **F1** to start calibration - and **Space** to move into the environment. This method is also further explained in the specific article, see the bottom.
   * **Varjo**. Press the **Left button on top of the headset twice**, once for opening the calibration, and once more for starting the calibration. The respondent will automatically be sent back to the environment when completing the calibration.
   * **HTC Vive Pro Eye**. Press **Space** to start the calibration process, or you can click the button in the top left corner called "**Launch Calibration**" (only visible to the Operator). The respondent will be asked to adjust their headset, then adjust lenses, and then calibrate the eyes. When complete, they will be transported back into the environment.
4. If iMotions reports "Missing Eyes", or Global Settings state that the connection to the HMD cannot be established, press **Alt+C**, or click "*Preferences*" > "*Reconnect Sensors*". This will re-establish the connection to the HMD with Eye Tracking. Since the Unity Executable is now running it will stream data into iMotions automatically. Please note that data is only streaming, and no data is recorded yet.
5. Start the recording in iMotions by clicking on the respondent and then pressing the red button "Start Recording". Please note that data is only stored once this button has been pressed.

   ![The Start Recording button](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-4d2a62bcfc1e308babf5581011434a35e314f481%2Flab_recording_start-recording-button.png?alt=media)

   iMotions is now recording the screen in conjunction with the eye tracking data provided by the HMD.

   ![vr\_setup\_10.png](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-301e097d3dd43a49df488635904456628939505c%2Fec3e8a1a6d_image-1704451968027.webp?alt=media) **NOTE**: The eye tracking data is being recorded in units of screen pixels (2D). It is therefore important that you keep your Unity EXE in front of all other windows. You might want to consider a dual-screen setup where iMotions is shown on screen 1, and Unity is shown on screen 2. Any pop-up windows and dialogs overlaying the Unity EXE will be present in the recorded dataset and screen recording.
6. Once the VR study has been accomplished, stop the recording in iMotions. You can do so by clicking the "End Recording" button or using the "Next Slide" key (default: **SHIFT+SPACE**). Afterwards, close the Unity EXE (**Alt+F4**).

## \[4] Eye Tracking Data Analysis in iMotions

All the ordinary iMotions eye tracking analytics apply to VR studies. Your primary way of constructing AOIs + heatmaps might be using our [Gaze Mapping](https://help.imotions.com/lab/analysis/eye-tracking/gaze-mapping/gaze-mapping.md) technology. Alternatively, you can place [dynamic or static AOIs](https://help.imotions.com/lab/analysis/eye-tracking/areas-of-interest/areas-of-interest-aois.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.imotions.com/lab/study-setup-and-design/virtual-reality/how-to-set-up-and-conduct-a-vr-study-with-screen-recording-in-unity-and-imotions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
