The SDK of this version is still being tested, and these pages are being updated with it: names, menus and procedures may still change before the release. If you build content for a platform already in production, follow the documentation of that version — pick it from the version menu at the top right.
Task Step
TaskStepPlaceholder
The Task Step Placeholder holds the settings of one step of a procedure: how much it is worth, whether it counts, its name in the analytics and how many wrong attempts it allows. It also gives you the step's events and methods.
Add it to the GameObject of a task, beside its Task component. It is optional: a task without one is scored with the defaults (weight 1, scored when it is a leaf task shown in the task panel).
Settings
| Setting | Default | What it does |
|---|---|---|
| Weight | 1 | The share of the procedure's score, relative to the other scored steps. A step of weight 2 is worth twice a step of weight 1 |
| Scored | Auto | Auto: the step counts when its task is a leaf (it has no sub-tasks) and is shown in the task panel. Yes: it always counts. No: it never counts |
| Step Id | empty | The name of the step in the analytics. Empty: the name of the task's GameObject. Letters, digits, - and _ only: any other character becomes _ |
| Max Attempts | 0 | Wrong attempts that fail the step. 0: no limit. A step that fails scores 0 |
The points are worked out by the procedure: see Steps and scoring.
The texts of a step
A step has four texts. The description is the text of the task panel; the other three are used by the procedure.
| Text | Where you write it | What the user sees |
|---|---|---|
| Description | The task node (in the graph window: Description) | The text of the task in the task panel |
| Hint | The task node: Hint | When the user asks for a hint on this task |
| Right Feedback | The task node: Right Feedback | When the task is done right. Empty: a generic "well done" |
| Wrong Feedback | The task node: Wrong Feedback | After a wrong attempt on the task. Empty: the reason of the wrong result, or a generic text |
To show them in more than one language, add a Localize Task Placeholder to the task and fill in the keys of the Localization File: Hint Key, Right Feedback Key and Wrong Feedback Key. For each text the procedure uses, in this order:
- the translation of the key, when the key is set and the file has a translation for it;
- the text written on the task node;
- the generic text (right and wrong feedback), or nothing (the hint).
The hint and feedback keys are used whenever they are filled in, whether Localize Description is ticked or not.
The texts the procedure resolved are readable from a script on the placeholder, in the user's language: HintText, RightFeedbackText and WrongFeedbackText (empty when there is none). They are filled in when the run starts and again when the language changes.
Events and methods
The events are raised for every report on this task, from any source (an element, a script, a node, another user in a shared procedure).
| Event (script) | UnityEvent | When |
|---|---|---|
Unlocked (TaskEventHandler) | On Unlocked | The task becomes to do |
Attempted (TaskResultHandler) | On Attempted | An attempt that does not complete the task |
Completed (TaskResultHandler) | On Completed | The task is completed, with the result that completed it |
TaskFailed (TaskFailedHandler) | On Failed | The task fails, with the reason |
HintShown (TaskEventHandler) | On Hint Shown | A hint is given for this task (procedures only) |
| Method | What it does |
|---|---|
Complete() | Completes the task with a right result |
Complete(TaskResult result) | Completes the task with a result |
Attempt(TaskResult result) | Reports an attempt that does not complete the task. A wrong one is an error of the procedure |
Fail(string reason) | Fails the task, with a reason for the summary |
Unlock() | Unlocks the task |
ShowHint() | Shows the step's hint, as the procedure's hint settings say. It needs a Procedure Placeholder on the task system: without one it does nothing |
They work like the Tasks API does for the task of this object. The result is a TaskResult: see Results. Without a procedure, Complete() completes the task as the Complete Task node does, and the events are still raised.
Every handler of an event runs; if one throws, the exception is thrown after the others have run, so one broken handler does not hide the rest.
What not to do
- Do not put texts in the Task Step. It has none: the description, hint and feedback are on the task node and the Localize Task Placeholder.
- Do not report on a task that is already completed, failed or locked. The report is ignored (logged once for the task): the task keeps what it had. A locked task takes a report only when the procedure's Out Of Order Is Error is on, as a wrong attempt.