Skip to main content

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.

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).
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).

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 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

Step → Auxiliaries → StepScoringAuxiliary expanded.

StepScoringAuxiliary in Unity Inspector