> ## Documentation Index
> Fetch the complete documentation index at: https://docs-unity.molca.id/llms.txt
> Use this file to discover all available pages before exploring further.

# StepScoringAuxiliary

> Per-step scoring configuration and session posting integration.

**File:** `Assets/_MolcaSDK/_VR/Scripts/Scenario/Scoring/StepScoringAuxiliary.cs`\
**Attached via:** [Step](/core/step) **Auxiliaries** list ([VR step auxiliaries](/vr/steps/vr-step-auxiliaries))

## Role

Holds a [ScoringConfig](/vr/scoring/scoring-config). **`OnStepBegin`** starts the timer; **`OnStepUpdate`** refreshes **time-based** configs via **`IsTimeBased()`**; **`OnStepCompleted`** / **`OnStepEnd`** call **`FinalizeScore()`** (idempotent).\
Score evaluation now includes an internal **manual offset** (`manualScoreOffset`) added on top of `ScoringConfig.CalculateScore(...)`, so external bonus/penalty adjustments persist into the finalized value.\
When **`postScoreToSession`** is true, **`PostStepScoreAsync`** runs after resolve checks (**`ScenarioSessionManager`**, **`ScenarioActivity`**, **`ActivityData`**, org IDs from [Scenario Data Config](/setup/scenario-data-config)).

## Code

```csharp theme={null}
using MolcaSDK.VR.Scenario.Scoring;

// From another component with a reference to the same Step:
void OnTraineeSucceeded(StepScoringAuxiliary scoring)
{
    scoring.SetCorrect();
}

void OnPartial(float accuracy01)
{
    scoring.SetAccuracy(accuracy01);
}

// Subscribe for HUD:
void Register(StepScoringAuxiliary scoring)
{
    scoring.OnScoreChanged += p => { /* update UI */ };
    scoring.OnScoreFinalized += final => { /* lock display */ };
}
```

**`AddBonusPoints`** mutates the internal manual offset until finalization. This supports **positive bonus** and **negative penalty** values, including when called via **`StepScoringBridge`** UnityEvents.\
For **PointValue** score type, this means final score is **base point value + manual offset** (not base score only).\
**`GetMaxPossibleScore()`** delegates to **`ScoringConfig`** and does not automatically include runtime manual offsets.

## Troubleshooting

* **Session post warnings** — Orgs and step IDs must exist in fetched content (**`OrgScenarioId`**, **`org_activity_id`**, **`org_step_id`**); session must be **active**. Missing **`ScenarioActivity`** on the sequence resolves to failed post.
* **Time score not moving** — Only **TimeBonus**, **TimePenalty**, **Countdown** refresh during **`OnStepUpdate`**; **PointValue** stays fixed until time still advances internal **`elapsedTime`** for posting only.
* **PointValue final stays at base score** — Ensure the bonus/penalty event is wired before completion (`StepScoringBridge.AddBonusPoints(float)`), and verify it fires before **`FinalizeScore()`**.
* **Accuracy ignored** — Call **`SetAccuracy`** / **`SetCorrect`** before **`FinalizeScore`** for **Binary** / **Accuracy** types; default **`accuracyValue`** starts at **1**.

## Unity Editor

<Frame hint="Step → Auxiliaries → StepScoringAuxiliary expanded." caption="StepScoringAuxiliary on a Step">
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/ptmolcateknologinusantara/images/features/vr/scoring/step-scoring-auxiliary.png" alt="StepScoringAuxiliary in Unity Inspector" />
</Frame>
