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.
From the Place Actors tab, drag an empty actor into level, and place it where the question needs to appear:
Add the following components to the actor:
Question Prefab Constructor
Select the Transform Saver component, and click “Save Transform” to save the location and orientation of the blueprint actor:
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.
QuestionPrefabConstructor component, and find the “Text of Header” property:
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:
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:
To create the question action, create a new blueprint that inherits from the BPQuestionAction class:
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: