Question Action

To create a question action, a Blueprint with a Question Prefab Constructor component is required. In this tutorial, we’ll recreate the Question Action from the Sample Application level. The question will involve a prompt asking the user: “Where is Sponza located?”, with 3 incorrect answers, and 1 correct answer.

We’ll start by creating the question blueprint first, and then use it inside the action.

Question Blueprint

From the Place Actors tab, drag an empty actor into level, and place it where the question needs to appear:

../../../_images/question_action_00.png

Add the following components to the actor:

  • Transform Saver

  • Mages View

  • Question Prefab Constructor

../../../_images/question_action_01.png

Select the Transform Saver component, and click “Save Transform” to save the location and orientation of the blueprint actor:

../../../_images/question_action_02.png

Next up, the Prefab Constructor needs to be configured with the Question text itself, as well as the various options that will be available to the user.

Select the QuestionPrefabConstructor component, and find the “Text of Header” property:

../../../_images/question_action_03.png

This will be the prompt seen by the user, before the options appear; Set it to: “Where is Sponza located?”.

Additionally, in the “Option List” property, click the ‘+’ button 4 times, to add 4 new possible answers. Expand all of the new items, and set their properties as seen below:

../../../_images/question_action_04.png

We have finished configuring the constructor, so all that remains is to save it as a blueprint: Click the “Blueprint/Add Script” button, and save it wherever you would like:

../../../_images/question_action_05.png

Question Action

To create the question action, create a new blueprint that inherits from the BPQuestionAction class:

../../../_images/question_action_06.png

The blueprint node for the question action can be seen below. Essentially, it registers our Question Blueprint as the blueprint to be used for the action itself:

../../../_images/question_action_07.png

Add Action to the Scene Graph

Finally, we have to add this action to the Scene Graph. You can view a detailed tutorial on how to do this here.