Skip to content

Comprehensive Setup Guide

You should completed the Minimal Setup Guide first. This page will give you an overview of the Core Features you'll encounter when implementing the SDK.

Start and End Sessions

The default behaviour is to automatically begin a Session 2 seconds after the experience begins. This can be changed on the CognitiveVR_Manager component.

initialize on start

If you choose to manually start a Session, you can include properties as optional arguments. Alternatively, you can add properties later. End Session is automatically called when the application closes or the editor stops playing. In some cases you may want to manually End a Session - for example if a Participant makes multiple attempts on a training exercise without closing the application. Sessions will persist between different Scenes.

Participants should consent to data collection as described in your privacy policy. If you do not wish to record analytics for any reason, simply do not call Initialize.

    public void ParticipantConfirmed(bool AcceptedPrivacyPolicy)
    {
        //if participant accepted privacy policy, begin recording analytics
        if (AcceptedPrivacyPolicy == true)
        {
            CognitiveVR_Manager.Instance.Initialize();
        }
        //... other setup logic
    }

    public void ExperienceComplete()
    {
        CognitiveVR_Manager.Instance.EndSession();
        //... load hub scene
    }

Session Name

You can set a custom name for a Participant's Session. This can be useful for organizing Sessions on the Dashboard and SceneExplorer. If you do not provide a Session name, it will use the Participant Name. If that is also not provided, a Session Name will be generated for you and can be changed on the Dashboard. You can set a Session Name before or after the Session is initialized.

CognitiveVR.Core.SetSessionName("JohnSmith_001");

Session Property

You may have some additional data to record that is relevant to the entire Session. For example, if you are doing A/B testing on a focus group, this could be a good place to record which group the Participant is in. You can set Session Properties at any time during the experience - but they will overwrite any property with the same name.

CognitiveVR.Core.SetSessionProperty("focus_group", "b");
CognitiveVR.Core.SetSessionProperty("starting_money", 25);

Gaze and Fixations

Recording the participant's HMD position, rotation and where they are looking is automatic. Most SDKs that support Fixations do not need any additional setup, but you should check the HMD Specific Information page to be sure.

Multiple SDKs

Some VR SDKs that support Eye Tracking are based on other hardware and allow multiple SDKs to take full advantage of a HMD. You may select multiple SDKs with Shift + Left Clicking each SDK you wish to use.

multiple sdks

Scenes

For more information, see Scenes.

Data recorded by the SDK will be uploaded to the Scene that was last loaded in Unity if that Scene has been exported and uploaded to our Dashboard using the Scene Setup Window.

There are no special requirements to use this feature. Simply use your normal process to load a scene. For example:

void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
        SceneManager.LoadScene("NewSceneName");
}

Dynamic Objects

For more information, see Dynamic Objects.

Dynamic Objects have quite a wide number of uses, but two common ones are Recording Controller Inputs and Spawning Objects.

Recording Controller Input

In most cases, the Scene Setup Window will prompt you to select the Left and Right controllers for the Participant if the VR SDK you have selected supports controller input. See Multiple SDKs above for details.

Spawning Objects

If you want to record a Prefab spawned during runtime, you can follow these steps:

  • Add the Prefab to your scene
  • Add a Dynamic Object Component to your Prefab
  • Press "Export" then "Upload" on the Dynamic Object Component
  • Apply the changes to the Prefab
  • Remove the Prefab from your scene

Then, whenever you Instantiate that GameObject, it will be displayed in SceneExplorer. For example:

public GameObject Prefab;
void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
        Instantiate(Prefab, Vector3.zero, Quaternion.identity);
}

ExitPoll

For more information, see ExitPoll.

ExitPoll allows you to get direct answers from your Participants. There are two parts to set up:

  1. Create a Question Set and Hook on the Dashboard.
  2. Create an ExitPoll in Unity using the Hook.
public string ExitPollHook = "samplehook";
void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
        CognitiveVR.ExitPoll.NewExitPoll(ExitPollHook).Begin();
}

This will result in something like:

exitpoll in unity

Custom Events

For more information, see Custom Events.

Custom Events are a great catch-all to record when 'something' happens in your experience. There are multiple ways to add additional information for context. Here is a very simple example:

public string Category = "Pressed Space";
void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
        new CognitiveVR.CustomEvent(Category).Send();
}

You can see the events on the Dashboard on the Session Details page.

Sensors

For more information, see Sensors.

If you have any continuous value to track during your session, you can record it as a sensor. We do not support any biometric sensors directly, but any value you can access in Unity can be recorded. Most sensors in most use cases do not need to be recorded at the highest frequency.

IEnumerator Start()
{
    while (Application.isPlaying)
    {
        yield return new WaitForSeconds(0.1f);
        CognitiveVR.SensorRecorder.RecordDataPoint("HeartRate",GetHeartRate());
    }
}

float GetHeartRate()
{
    //return some value from your heart rate sensor
}

sensor image

Participants

For more information, see Participants.

Correctly identifying Participants during your experience allows you to track how their performance changes over time. This should include a Unique ID (such as employee number) and a friendly Full Name.

You can also set properties to group your participants together.

void Start()
{
    CognitiveVR.Core.SetParticipantFullName("John Smith");
    CognitiveVR.Core.SetParticipantId("E001");
    CognitiveVR.Core.SetParticipantProperty("height",180);
}

Local Cache

If no internet connection is detected, the SDK will temporarily store data locally. When internet connectivity is restored the SDK will automatically queue up this cached data and send it in the background. This works between sessions, so you can freely start more sessions even when offline. Click cognitive3D->Advanced Options to change the Upload Local Cache Rate and the Cache Size.

Attributions

For more information, see Attributions.

When opening a URL from your experience, you can append an Attribution Key. This can be captured on your webpage to identify which Session engaged with this content outside of your immersive experience.

void Start()
{
    string parameters = CognitiveVR.Core.GetAttributionParameters();
    Application.OpenURL("www.example.com/product_005" + parameters);
}