Using ExitPoll

Overview

ExitPoll allows you to directly ask questions to your users. 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.

Prerequisites

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.

panels

  • 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
  • Buttons are interacted with by the user's gaze, so no assumptions are made about your input methods

button

  • The buttons have a small radius that fills while the user 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 minimum 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

gradient

Creating an Exit Poll

Exit Poll Hooks and Question Sets are created on the Cognitive3D Dashboard. A Hook is requested from the application during the experience and receive a Question Set as a response. This allows you to use change which Question Set to display from a Hook without updating your application.

The example here will display a Question Set about performance at the end of the level.


Press the New Question Set button.

new question set

Add your questions. Each question will be displayed as a panel one at a time.

apply question set

Select Create Question Set. Then select Manage Hooks.

new hook

Select New Hook to open the popup.

hook popup

Assign your Question Set and version for the Hook.

select hook

Displaying an Exit Poll

An Exit Poll can be displayed with this code:

void Start()
{
    //notice the ExitPoll uses the Hook Name as an argument
    CognitiveVR.ExitPoll.NewExitPoll("scene_complete").Begin();
}

Only one exit poll can be active at a time.

The Exit Poll 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.

When creating an Exit Poll, you may include many other methods to modify how the panels will display. Here is a complete list of methods:

private void Start ()
{
    //an action to display a debug message
    System.Action debugCloseAction = () => Debug.Log("ExitPoll closed");

    CognitiveVR.ExitPoll
        .NewExitPoll("scene_complete")                            //closes any existing exit poll and displays a new question set using the HookName
        .SetEndAction(OnEndExitPoll)                        //sets an action to happen when the exit poll is completed
        .AddEndAction(debugCloseAction)                   //adds another action to perform when the exitpoll is completed
        .SetPanelLayerMask("Default", "World", "Ground")    //sets layers the Exit Poll Panel will avoid spawning in
        .SetDisplayDistance(3, 1)                         //set the prefered distance from the player to display the Exit Poll
                                                            //Can go down to the minimum distance to avoid collisions with layermask set above
        .SetDisplayReticle(true)                          //creates a small reticle to display where the user is gazing while the exit poll is active
        .SetLockYPosition(true)                             //display the exit poll at the same y height as the HMD
        .SetRotateToStayOnScreen(true)                    //move the Exit Poll Panel to stay in front of the player
        .SetStickyWindow(true)                              //move the Exit Poll Panel if the user 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 user does not answer
        .Begin();
}

private void OnEndExitPoll()
{
    //some code
}

The EndAction can be very useful to continue your experience after the player 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.

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 void ManuallyCloseExitPoll()
{
    CognitiveVR.ExitPoll.CurrentExitPollSet.EndQuestionSet();
}