ViRSE incorporates a powerful and flexible ‘quiz’ system that can be used for many purposes

<aside> ℹ️ Examples of quiz system usage:

Overview

Quizzes are set up by creating a hierarchy of GameObjects with various V_Quiz components attached.

For instance, the provided sample prefab SimpleQuiz (see below) shows how to construct a simple multiple choice quiz. The root of the prefab is a GameObject with a V_Quiz component (representing the quiz). This has three child GameObjects (Q1, Q2, ,Q3) each with a V_QuizQuestionMultipleChoice component. Each of these question GameObjects has several child objects representing multiple choice answers - these are the GameObjects called A,B,C and D, each of which has a V_QuizAnswer component. All of these gameobjects have no components except these V_Quiz components - this is the recommended approach, although you may want to add a custom script to your root object (with V_Quiz) to make it start at the right time.

Sample SimpleQuiz prefab showing component hierarchy.

Sample SimpleQuiz prefab showing component hierarchy.

SimpleQuiz prefab, once triggered, displaying in the ViRSE UI.

SimpleQuiz prefab, once triggered, displaying in the ViRSE UI.

Details of about the quiz, questions and answers, e.g. the text to display, scores etc., are all properties of the various quiz components, and can be set through the inspector. Most quizzes can thus be set up without any coding, and you do not need to create any UI objects for your quiz – these are created automatically by ViRSE when the quiz is started.

Quizzes can (if you wish) store persistent data (scores and responses) in a database on the ViRSE server, or they can generate instant feedback for the users. They can operate in single-user or synchronised multi-user modes, and can appear in either the main UI on the ViRSE menu panel, or within your world on a world-space canvas.

An extensive API is provided through which your code can interact with quizzes if it requires more complex functionality, but most applications will only require code to trigger the quiz to display at the appropriate time, e.g.

gameObjectWithV_QuizOnIt.GetComponent<IQuiz>().Show();

Quiz Questions

Two types of question are supported - multiple choice (use the V_QuizQuestionMultipleChoice component), and free text (use the V_QuizQuestionText component). To reorder, add or delete questions, simply reorder, add or delete GameObjects bearing these components in the hierarchy.

If you want a question to not appear in the quiz, but don’t want to delete it, disable the GameObject that represents it in the inspector. You can also do this in code (before starting the quiz) if you want to modify the quiz programmatically.

Only V_QuizQuestionMultipleChoice questions require child objects with answers. You can have as many or as few answers as you want.

Adding images

If you want to incorporate images into a quiz, there are three ways to do so.

A vertical image is placed either to the left or right of the answers, and is set up using inspector properties of the V_QuizQuestion component.

Vertical image - set up in question properties

Vertical image - set up in question properties

Horizontal images (such as the upper picture in the example below) are only available for multiple choice questions. They are placed within the answer region, by creating a GameObject with a V_QuizHorizontalImage component as a child of the question GameObject. They can appear above, below or in-between questions, by reordering the GameObjects in the hierarchy (here the image appears at the top as the GameObject with the image component is the first child of the question object).

Finally, you can add per-answer images for multiple choice answers. These are set up in the V_QuizAnswer component - all answers in the example below have these, showing the same image, and set to appear to the left of the answer.