Export survey from Google Forms
In Google forms, all you have to do is to create a form as you used to do. After that, click on “three dots'' in your Google Form and select the script editor. Copy all code from your Unity project: Assets/Scripts/Resources/GoogleFormsScript.txt and paste it into the script editor and save (Ctrl + s). Then reload the page with your form and you will see a puzzle piece icon, click on that and select “XRsurvey“ and export. If the puzzle icon is not visible after loading, try to close and reopen the form, or try bypassing the cache (Ctrl + F5), or clear the cache. For the first run (Google will ask for permissions), you have to agree with all Google terms and then run the script again (for the first run, Google only deals with permission). This is needed for every newly created form. After this, the script will create a folder in your Google Disk with the name of your form and in this file, you will be able to find the .csv file which you will use to export into Unity.
Warning: In Google Form settings, make sure you have unchecked the “Restrict to users in someCompany” option. Without that, the script will not work.
Supported question types
Our asset supports following question types and properties:
- Short answer
- Multiple choice
- Linear scale
- Multiple choice grid
- Checkbox grid
- Supported properties
- Required option (all questions types) - To successfully complete a survey in Unity, the user first needs to answer all mandatory questions.
- Description (all questions types)
- Include Time (date questions)
- Include Year (date questions)
- Time (time questions)
- Duration (time questions)
Not supported Questions and properties:
- File upload
- Validations (all questions types)
- Limit one response to column (grid questions)
- Shuffle - Can be set manually in the Unity project.
Import survey to your Unity project
To import surveys, you have to download the XRS_ExportedForm.csv file from your folder in your Google Drive account. Open your project in Unity and put the mentioned file in /Assets/Scripts/Resources (rewrite the existing one).
Import survey name and description
You can import the survey name and the description, unless you want to fill it in later manually. Choose the “Import description and name from .csv” in the XRsurveys Toolbar.
Import survey questions
To spawn the question boards in your scene, you need to click on the XRsurveys Toolbar and choose the “Import Survey from .csv” option.
Warning: If you want to import a new survey, you have to delete old questions.
Questions / survey update
If you have changed the survey in Google forms (altered texts, new questions etc.), you can also update the survey in Unity. To do that, simply import and overwrite the XRS_ExportedForm.csv (same as inserting a new survey). Then, click on the “XRsurveys“ bar and choose the “Update Survey from .csv” option. After that the old questions are updated, but the positions and scales remain the same, and the new questions spawn at a separate object “NewQuestions”.