Using ExitPoll

ExitPoll Video Guide


ExitPoll allows you to directly ask questions to your users. This requires a prefab in Unity, a line of code, and tuning variables from your cognitiveVR product page. This page will walk you through the process of enabling and configuring an ExitPoll in your application.

ExitPoll is included in version 0.4.7+ of the cognitiveVR SDK. Download the latest version from github


Prefab Overview

The ExitPoll prefab should be ready to use in any application. It was built to be flexible and easy to change to fit your art and functionality.


  • The ExitPoll panel uses Unity's built in Canvas system
  • All the art is separated from the functioning part of this panel, so replacing this with your assets should be easy
  • The three buttons (positive, negative and close) require the user's gaze to interact


  • The buttons have a small radius that fills while the user is looking at it
  • It uses a dot product to determine the user's gaze
  • The action is similar to Unity's Canvas buttons - they can invoke functions on other components. These are loosely connected so you can replace these buttons with your own button script with minimum effort

Prefab Advanced


ExitPollQuestion string field retrieves and displays a Tuning Variable with this name. This will be covered in the next section


  • Display Distance is the desired distance from the HMD to instantiate the ExitPoll prefab
  • Minimum Display Distance is the minimum distance from the HMD the ExitPoll prefab will spawn. If the ExitPoll distance is below this value, it will ignore the exit poll and continue with gameplay
  • Layer Mask determines what will reposition the ExitPoll prefab toward the HMD when spawning up to the Display Distance
  • Popup Time is the duration of the appear/disappear animation
  • X/Y Scale are scale values to animate the window appearing. This is all contained in the SetVisible(bool visible) method in the ExitPollPanel script
  • Response Delay Time delays interactivity after the panel pops up. This gives the user a bit of time to understand the panel and read the question
  • Time Out closes the window and continues with gameplay if the user has not given a response in this time

Display Options

  • Lock Y Position instantiates the ExitPoll prefab at the user's HMD height
  • Display Reticule creates a small reticule at the distance away from the ExitPollPrefab. This is attached to the camera and is removed after the ExitPoll closes
  • Rotate To Stay On Screen rotates the ExitPoll prefab to try and remain in the direction the user is facing
  • Sticky Window repositions the window if the player moves

ExitPoll Settings


When an ExitPoll prefab is spawned, it will search for your ExitPoll settings to find ExitPollQuestion. If this variable cannot be found, it will display the question set on the prefab. The ExitPoll settings can be found under ExitPoll > Settings on the dashboard.


Displaying the ExitPoll panel can be done with this code:

//whenever you want to spawn the ExitPoll prefab
void YourLevelObjectiveComplete()
    System.Action closeAction;

    //method call without arguments
    closeAction = ShowCredits;

    //method call with arguments
    closeAction = () => BeginLevel("Overworld");

    //Actions are neat
    closeAction += () => Debug.Log("ExitPoll closed");

    //spawning the ExitPoll prefab that will invoke the action after it is answered

void ShowCredits()
    //some code

void BeginLevel(string LevelName)
    //some code

closeAction is invoked when the question and microphone are answered.

CloseAction will be called immediately if there is some issue with displaying the questions, such as the spawn point of the ExitPoll prefab is too close to the HMD position.