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/ScoringConfig.cs

Aggregation layers

ScoringConfig instances are used at step, activity, and scenario levels: See Step scoring auxiliary, Activity scoring, and Scenario scoring.

ScoringType reference

Enum values and behavior match ScoringConfig.CalculateScore(float timeTaken, float accuracy = 1f) in ScoringConfig.cs. After the switch, the result is multiplied by scoreMultiplier; if allowNegativeScore is false, the final score is clamped to ≥ 0. IsTimeBased() is true only for TimeBonus, TimePenalty, and Countdown (drives StepScoringAuxiliary OnStepUpdate refresh).
ScoringTypeUses timeTakenUses accuracyPrimary serialized fieldsCalculateScore (before multiplier & negative clamp)
None(none)0
PointValueIgnoredIgnoredbasePointsbasePoints
BinaryIgnoredYes (0–1)correctPoints, incorrectPointscorrectPoints if accuracy >= 0.5, else incorrectPoints
TimeBonusYesIgnoredtargetTimeSeconds, maxTimeSeconds, minPoints, maxPointsIf timeTaken <= targetTimemaxPoints. If timeTaken >= maxTimeminPoints. Between: linear lerp from maxPoints at targetTime down toward minPoints at maxTime.
TimePenaltyYesIgnoredmaxPoints, pointsPerSecond, minPointsmaxPoints - (timeTaken * pointsPerSecond), then max(score, minPoints) (floor)
CountdownYesIgnoredcountdownDuration, pointsPerSecondremaining * pointsPerSecond where remaining = max(0, countdownDuration - timeTaken)
AccuracyIgnoredYes (0–1)minPoints, maxPointsLerp(minPoints, maxPoints, Clamp01(accuracy))

Shared tuning (all types except None)

FieldRole
scoreMultiplierApplied to the computed score after the switch.
allowNegativeScoreIf false, final score is max(0, score) after the multiplier.

GetMaxPossibleScore() (UI caps & normalization)

ScoringTypeReturns (before needing final clamp in callers)
None0
PointValuebasePoints * scoreMultiplier
BinaryMax(correctPoints, incorrectPoints) * scoreMultiplier
TimeBonus, TimePenalty, AccuracymaxPoints * scoreMultiplier
CountdowncountdownDuration * pointsPerSecond * scoreMultiplier

Implementation detail

Prefer calling CalculateScore / GetMaxPossibleScore on ScoringConfig rather than duplicating formulas in gameplay code. StepScoringAuxiliary sets accuracy for Binary / Accuracy via SetCorrect, SetIncorrect, SetAccuracy, SetAccuracyPercent before finalize — see Step scoring auxiliary.

When to use

Embed ScoringConfig (serialized class, not necessarily a standalone asset) wherever scoring is configured: StepScoringAuxiliary, ActivityScoring, ScenarioScoring. Choose None when the layer should not contribute numeric score but you still want a placeholder in the Inspector.

Troubleshooting

  • Scores always zeroType may be None; or time-based config has maxPoints / windows set so the formula yields 0 at current timeTaken / accuracy.
  • Binary feels inverted — Accuracy is 0–1: use StepScoringAuxiliary.SetCorrect / SetIncorrect (or SetResult(bool)) so CalculateScore treats correct as 0.5 and above and incorrect below 0.5.
  • Unexpected negatives — Enable allowNegativeScore or raise minPoints / adjust TimePenalty rate; final value is still multiplied by scoreMultiplier.

Unity Editor

Embedded ScoringConfig on StepScoringAuxiliary or standalone asset if you use ScriptableObject variants.

ScoringConfig in Unity Inspector