Sample: Surveys

PlayUR allows for simple surveys in-game. The emphasis is on simple, as only basic likert-scale questions can be presented. It is highly recommended to link externally to a different survey provider like Google Forms or Qualtrics.

Defining a Survey

In Unity in the Project Panel, you can create a survey object by right-clicking and choosing Create -> PlayUR -> Survey. This creates a scriptable object with the following fields: image

  • Questions should contain a list of Survey Question objects (see below)
  • The Analytics Action and Analytics Columns should be set to ensure that survey responses can be stored in the analytics folder. A row is created for each question response with the given Action, with a Column for the question number, and another Column for the question answer.
  • You can leave the *Prefab values blank and the default visual style will be applied, or you can attempt to make a Prefab Variant of the prefabs provided in the PlayURPlugin Folder / Runtime / Survey folder.

Note that a sample survey object is available in the Package folder for the Game Experience Questionaire. image

Defining a Survey Question

To create a question for a survey, choose Create -> PlayUR -> Survey Question. This creates a scriptable object with the following fields: image These question objects should be added to the Question field of a Survey object.

Displaying a Survey

Once a survey has been defined, it can be shown at any time by passing the scriptable object to the ShowSurveyPopup function.

using UnityEngine;
using PlayUR.Surveys;

public class SurveySample : MonoBehaviour
{
    public Survey survey;

    public void DoSurvey()
    {
        PlayURPlugin.instance.ShowSurveyPopup(survey);
        //note there is also a coroutine version
    }
}

Unity Sample Requirements

You can import this sample from the Unity Package Manager. For the code to run, you will need a game set up in Unity (see Getting Started), and the following configured for the game on the PlayUR Dashboard:

  • Analytics Action for Survey Responses
  • Analytics Columns for Survey Question and Survey Answer
In This Article
Back to top Generated by DocFX