Skip to main content
File: Assets/_MolcaSDK/_VR/Scripts/Scenario/Scoring/StepScoringAuxiliary.cs
Attached via: Step Auxiliaries list (VR step auxiliaries)

Role

Holds a ScoringConfig. OnStepBegin starts the timer; OnStepUpdate refreshes time-based configs via IsTimeBased(); OnStepCompleted / OnStepEnd call FinalizeScore() (idempotent). When postScoreToSession is true, PostStepScoreAsync runs after resolve checks (ScenarioSessionManager, ScenarioActivity, ActivityData, org IDs from Scenario Data Config).

Code

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 running total until finalization. GetMaxPossibleScore() delegates to ScoringConfig.

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.
  • Accuracy ignored — Call SetAccuracy / SetCorrect before FinalizeScore for Binary / Accuracy types; default accuracyValue starts at 1.

Unity Editor

Step → Auxiliaries → StepScoringAuxiliary expanded.

StepScoringAuxiliary in Unity Inspector