Skip to content

Using ExitPoll


ExitPoll allows you to directly ask questions to your participants. This only requires a line of code and and some options on your Cognitive3D dashboard. This page will walk you through the process of enabling and configuring an ExitPoll in your application.

exitpoll screenshot

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 user experience 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 buttons have a small radius that fills while the participant is looking at it
  • The On Look 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 minimal effort

Scale Panel

The ExitPollScale Panel includes a gradient property. This only has an effect on the Scale Panel. When the Scale Panel is created, it applies colours from this gradient based on the number of options the scale displays.

gradient settings


Displaying an ExitPoll

You should create an ExitPoll Hook as explained on the Dashboard Exitpoll page. You will need the Hook to display the ExitPoll in your experience.

The ExitPoll Question Set will be saved locally if Local Data Cache is enabled. This can be changed in cognitive3D->Advanced Options. If the device cannot reach the internet, it will display the last Question Set it recieved when there was a valid internet connection.


The ExitPoll Holder component is the recommended method to configure how your questions are displayed to the participant.

exitpoll component

  • Question Set Hook - Request the question set from the Dashboard using this Hook
  • Activate on Enable - Automatically display this question set when this component becomes enabled

  • ExitPoll Pointer Type - Spawns a temporary prefab that can interact with the answer buttons on the ExitPoll panels

  • ExitPoll Pointer Parent - Attaches the temporary prefab to a component so the participant can easily select answers

  • Tracking Space - World or Player Relative. Configures the behaviour of how the ExitPoll panel will move

  • (World Space) Attach Transform - If this is set, the ExitPoll panels will follow this GameObject. Otherwise, the panels will stay in the absolute world position they spawn at
  • (Player Space) Collision Layer Mask - The ExitPoll panel will try to spawn in front of the participant avoiding collision with GameObjects on these layers
  • (Player Space) Sticky Window - If the participant teleports, the ExitPoll panels will move to stay relative to the player
  • (Player Space) Lock Y Position - Match the ExitPoll panel with the vertical position of the participant's HMD
  • (Player Space) Default Display Distance - Sets the preferred distance to spawn the ExitPoll panel away from the participant
  • Automatic Timeout - If an answer is not selected within this time limit, the ExitPoll question will automatically skip to the next question

  • Panel Overrides - Allows you to display custom panels for this ExitPoll question set

  • On Begin - Events called when the ExitPoll is activated, has a valid question set and displays a panel

  • On Complete - Events called when the question set is completed successfully
  • On Close - Events called when the question set closes for any reason, including after OnComplete is called. If there is an error receiving questions, this may be called instead of OnBegin

If you do not use the 'Activate On Enable' option, the following code will display the Exitpoll with the properties set in the ExitPollHolder component:

public CognitiveVR.ExitPollHolder holder;
void SomeFunction()
    //display the ExitPoll


Instead of using the component described above, an ExitPoll can be displayed with this code:

void Start()
    //notice the ExitPoll uses the Hook Name as an argument

When creating an ExitPoll, you may include many other methods to modify how the panels will display. All options except NewExitPoll(hookname and Begin() are optional. Here is a complete list of methods:

public GameObject controller;

private void Start ()
    //an action to display a debug message
    System.Action<bool> debugCloseAction = (completed) => Debug.Log("closed exitpoll. completed? " + completed);

        .NewExitPoll("scene_complete")                            //displays a new question set using the HookName
        .SetEndAction(OnEndExitPoll)                        //sets an action to happen when the ExitPoll is completed
        .AddEndAction(debugCloseAction)                   //adds another action to perform when the exitpoll is completed
        .SetPanelLayerMask("Default", "World", "Ground")    //sets layers the ExitPoll Panel will avoid spawning in
        .SetDisplayDistance(3, 1)                         //set the prefered distance from the participant to display the ExitPoll
                                                          //Can go down to the minimum distance to avoid collisions with layermask set above
        .SetControllerPointer(controller)                   //set a controller gameobject that has an ExitPoll Pointer component. If one doesn't exist, this component will be added
        .SetPosition(                          //spawn the ExitPoll panels at this position, instead of in front of the participant
        .SetRotation(Quaternion.identity)                   //spawn the ExitPoll panels at this rotation, instead of rotated to face the participant
        .SetLockYPosition(true)                             //display the ExitPoll at the same y height as the HMD
        .SetRotateToStayOnScreen(true)                    //move the ExitPoll Panel to stay in front of the participant. Will also limit the distance to the ExitPoll panel based on the values from 'SetDisplayDistance'
        .SetStickyWindow(true)                              //move the ExitPoll Panel if the participant moves, such as teleporting
                                                            //This should not be used if the main camera does not have a root gameobject!
        .SetTimeout(true, 15)                               //sets a time limit that will skip the question if the participant does not answer

private void OnEndExitPoll(bool completed)
    //some code

The EndAction can be very useful to continue your experience after the participant responds to your question set. EndAction will be called immediately if there is some issue with displaying the questions, such as the requested HookName is invalid. The boolean parameter will be true if the participant has completed the ExitPoll and false if they encountered an error.

ExitPoll will close the question panel automatically when a question is answered. If you need to close the ExitPoll prematurely, you can use this code:

private ExitPollSet questionSet;
public void BeginExitPoll()
    questionSet = CognitiveVR.ExitPoll.NewExitPoll("scene_complete").Begin();

private void ManuallyCloseExitPoll()


Using the ExitPoll Holder component outlined above is a simple way to override which prefabs to use for a single ExitPoll question set. Or you can change the default ExitPoll Panel prefabs located in the CognitiveVR/Resources folder in your project. These are loaded by name in the ExitPoll class.


The visuals of each ExitPoll prefab are mostly separate from the functionality, so the background, buttons and text can be changed or removed as needed. In the case of the 'Scale' and 'Multiple Choice' Exitpoll types, all the buttons already exist in the prefab and are disabled as necessary.

Input system

The ControllerPointer component pointing at a VirtualButton component will call SetPointerFocus() each frame. The VirtualButton handles the visuals and delay before calling the OnConfirm action. This is implemented as a UnityEvent and can be set in the inspector. This calls the AnswerInt function on the ExitPollPanel component on the root GameObject with a property value.

A custom input must call AnswerInt similar to these default buttons. For example, you could create a new script and use Unity's OnCollision method to call this UnityEvent, or hardcode the function call and pass the correct value as a parameter. Here is a very simple code sample:

//OnImpact is set to call 'AnswerInt' in the inspector
public UnityEngine.Events.UnityEvent OnImpact;
private void OnCollisionEnter(Collision c)
    if (c.gameObject.CompareTag("hand"))