Components
ButtonObjective
Evaluate an explicit UI choice and complete only when the configured correct-option condition is satisfied.
Evaluate a deliberate UI choice
ButtonObjective converts a Unity UI action or another explicit event into either an accepted completion request or an invalid-choice response. Use one on the correct option, or configure a separate instance as an incorrect option when the interface needs neutral feedback without failing or advancing the Chapter.
It does not listen to Button.onClick automatically. Bind the Button's On Click event to ButtonObjective.Evaluate(). If project UI already validates the answer in code, calling the active Chapter directly can be clearer than creating several scene components.
Inspector fields
| Field | Behavior | Minimum setup |
|---|---|---|
| Objective Link | Inherited exact Ordered Objective binding | Required for a correct option |
| Is Incorrect Option | Prevents completion and invokes the invalid event | Enable only on choices that must not advance |
| On Invalid Option | Feedback for an incorrect choice | Optional; does not fail the Chapter |
| On Completed | Runs after the correct request is accepted | Optional scene-side feedback |
Execution, repeat calls, and reset
Evaluate() returns immediately after local completion. On an incorrect instance, every evaluation invokes OnInvalidOption and leaves progression untouched. On a correct instance, it calls the inherited TryComplete(); early, wrong-ID, or duplicate calls are rejected by the Chapter.
The component has no additional transient fields beyond the base completion flag. ResetObjective() therefore restores it through the inherited implementation. An incorrect option never sets the completion flag, so it remains available until the Chapter advances or the UI disables it.
Example: one correct and two incorrect answers
- 1Create one Ordered Objective named
Answer the access question. - 2Add a ButtonObjective to each answer Button and link all three to that row.
- 3Enable Is Incorrect Option on the two wrong answers; bind On Invalid Option to a short visual response.
- 4Leave the correct instance unchecked and bind each UI Button's On Click to its local
Evaluate.
Several Objective components linked to one row are normally a risky duplicate. For a multiple-choice interface, a single project controller that calls one correct ButtonObjective and handles wrong answers itself is often cleaner.