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

# ScenarioScoring

> Scenario-wide scoring roll-up and time-based helpers.

**File:** `Assets/_MolcaSDK/_VR/Scripts/Scenario/Scoring/ScenarioScoring.cs`

## Role

**`[RequireComponent(typeof(ScenarioManager))]`** — **`scenarioScoringConfig`** can add a **scenario base** score (time-aware while **`CurrentState == Active`**). **`includeActivityScores`** merges each child **`ActivityScoring`** using **`ScoreAggregationMode`**. Subscribes to **OnScenarioStart**, **Complete**, **Timeout**, **Fail**; finalize runs on end conditions. **`showScoreBreakdown`** logs **`GetScoreBreakdown()`** to the console.

## Code

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

public class ScenarioScorePanel : MonoBehaviour
{
    [SerializeField] private ScenarioScoring scoring;

    private void OnEnable()
    {
        scoring.OnScoreChanged += UpdateUi;
        scoring.OnScoreFinalized += ShowFinal;
    }

    private void OnDisable()
    {
        scoring.OnScoreChanged -= UpdateUi;
        scoring.OnScoreFinalized -= ShowFinal;
    }

    private void UpdateUi(float total) { }

    private void ShowFinal(float total)
    {
        var breakdown = scoring.GetScoreBreakdown();
        // breakdown.ActivityBreakdowns, ScorePercentage, etc.
    }
}
```

## Troubleshooting

* **Activity map empty** — **`scenarioManager.Activities`** must list **`ScenarioActivity`** objects that include **`ActivityScoring`**; **`CollectActivityScoring`** runs on start and scenario start.
* **Final score never locks** — Ensure **ScenarioManager** fires **OnScenarioComplete** / **Timeout** / **Fail**; otherwise call **`FinalizeScore()`** yourself for custom endings.
* **`ActivityScores` missing an activity** — Component must sit on the same object as **`ScenarioManager`**; activities need **`ActivityScoring`** attached.

## Related

* [ScenarioManager](/vr/scenario-manager)
* [Activity scoring](/vr/scoring/activity-scoring)
* [ScoringConfig](/vr/scoring/scoring-config)

## Unity Editor

<Frame hint="Scenario root or manager sibling with ScenarioScoring." caption="ScenarioScoring Inspector">
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/ptmolcateknologinusantara/images/features/vr/scoring/scenario-scoring-inspector.png" alt="ScenarioScoring in Unity Inspector" />
</Frame>
