Component Reference
This reference explains the key Sirocco Race Timing components, what they do, and the important Inspector fields.
Architecture note: business logic lives in
Assets/RaceTiming/Core/(pure C#). Unity integration lives inAssets/RaceTiming/Adapter/andAssets/RaceTiming/UI/.
RaceTimingManager (MonoBehaviour)
Location: Assets/RaceTiming/Adapter/RaceTimingManager.cs
Role: The Unity-facing entry point. Owns a Core LapTimer, configures sectors/finish conditions, and exposes UnityEvents.
Inspector: Configuration
AutoStartSession- If enabled, starts the session in
Start(). SessionConfig(required)- Reference to a
SessionConfigAssetScriptableObject containing session identity, countdown configuration, and finish condition settings. - Available presets (located in
Assets/RaceTiming/Presets/Sessions/):- Practice: No countdown, no finish condition (manual stop)
- Qualifying: Simple countdown (1 light), 15-minute timed session, best lap time order
- Sprint Race: F1-style countdown (5 lights, 30s pre-start), 10-lap race
- Feature Race: F1-style countdown (5 lights, 30s pre-start), 50-lap race
- Endurance Race: F1-style countdown (5 lights, 60s pre-start), 6-hour timed race with race end mode
- Custom configs: Create your own via
Assets > Create > RaceTiming > Session Config
Delta Bar Configuration:
- EnableDeltaBar
- If enabled, tracks micro-sector timestamps for delta bar calculations.
- MaxDelta
- Maximum delta in seconds for delta bar clamping. Default: 9.999.
- MicroSectorsPerSector
- Number of micro-sectors per regular sector. More micro-sectors = finer granularity. Default: 10.
Sector configuration:
- Sectors are configured on the track asset (TrackMarkerScriptableObject) via TrackMarkerManagerBehaviour.
- RaceTimingManager no longer exposes SectorCount/Sectors in the Inspector.
- You can view the resolved sector list at runtime via the read-only ResolvedSectors field.
Inspector: Events (UnityEvents)
These are UnityEvent wrappers around Core events:
- OnLapCompleted
- OnSectorCrossed
- OnSessionStarted, OnSessionFinished
- OnCompetitorRegistered
- OnPositionChanged, OnStandingsUpdated
- OnNewBestLap, OnNewSessionBestLap
- OnNewBestSector, OnNewSessionBestSector
- OnLappedStateChanged
- OnCheckeredFlagOut
- OnCountdownStartedUnity (fired when F1-style countdown begins)
- OnLightsOutUnity (fired when green lights activate)
Common usage
- Start:
RaceTimingManager.Instance.StartSession() - Stop:
RaceTimingManager.Instance.StopSession() - Access Core:
RaceTimingManager.Instance.LapTimer
Delta Bar API:
- GetDeltaBarData(competitorId) — Returns DeltaBarData for the specified competitor.
- SetReferenceLap(competitorId, lapRecord) — Sets a reference lap for delta calculations.
SessionConfigAsset (ScriptableObject)
Location: Assets/RaceTiming/Adapter/SessionConfigAsset.cs
Role: Unified configuration asset containing session identity, countdown settings, and finish condition parameters. Replaces separate countdown and finish condition fields.
Session Identity
SessionName- Session name shown in UI (e.g., "Q1", "Practice 1", "Race")
SessionTypeLabel- Optional display label for session type (e.g., "Qualifying", "Sprint Race")
Countdown Configuration
Countdown.Enabled- If enabled, session starts with a lights-out countdown sequence
Countdown.LightCount(1-5)- Number of red lights to illuminate
Countdown.RedLightIntervalMs- Interval in milliseconds between each red light activation
Countdown.GreenWindowMinMs/GreenWindowMaxMs- Random delay range after all lights are red before going green
Countdown.PreStartDelaySeconds- Pre-start delay before red light sequence begins (0 to skip)
Finish Condition Configuration
FinishCondition.TypeNone: Session runs until manually stoppedLapCount: Checkered flag after leader completes target lap countTimed: Session ends after configured duration- LapCount settings (when Type = LapCount):
TargetLapCount: Number of laps required- Timed settings (when Type = Timed):
DurationSeconds: Session duration in secondsTimedEndMode:QualifyingorRace(affects checkered flag behavior)TimedStandingsOrder:BestLapTimeorLapsCompleted
Creating Custom Configs
Assets > Create > RaceTiming > Session Config- Set session identity (name, type label)
- Configure countdown (enable/disable and set parameters)
- Configure finish condition (type and relevant settings)
- Save as a preset for reuse across scenes
Design Benefits
- Reusability: Save and reuse configurations across scenes
- Consistency: All session settings in one unified asset
- Composability: Future race meeting support (array of session configs)
- Better UX: Asset-based configuration vs. primitive fields
RaceCompetitor (MonoBehaviour)
Location: Assets/RaceTiming/Adapter/RaceCompetitor.cs
Role: Represents a vehicle/driver. Samples position in FixedUpdate and feeds Core timing.
Inspector
Id- If 0, auto-generated at runtime using
GetInstanceID(). CompetitorName- Defaults to GameObject name if empty.
ShortName- Optional 3-letter abbreviation for UI.
TeamColor- Used by UI (exposed as a hex string internally).
TrackMarkerManager- Optional reference. If not set, auto-finds the first
TrackMarkerManagerBehaviour.
Important behavior
- Runs timing updates in FixedUpdate for deterministic sampling (
Time.fixedTimeAsDouble). - Uses track markers (if present) to compute a track ratio (0..1) and detect lap wrapping.
- Reports samples to Core via
LapTimer.UpdatePosition(...).
TrackMarkerManagerBehaviour (MonoBehaviour)
Location: Assets/RaceTiming/Adapter/TrackMarkerManagerBehaviour.cs
Role: Unity wrapper around Core track marker management. Also draws gizmos and sector boundary markers.
Inspector
trackMarkerScriptableObject- The
TrackMarkersSOasset containing waypoint positions.
Runtime properties
trackMarkers: list of waypoint positionscumulativeDistances: cumulative distances along the looptotalTrackLength: track length in meters
RaceTowerUI (MonoBehaviour)
Location: Assets/RaceTiming/UI/RaceTowerUI.cs
Role: Displays a standings tower. Polls session data each Update.
Inspector
RowPrefab:RaceTowerRowUIprefabContainer: Transform under a Canvas hierarchy (often with a layout group)Mode: gap display modeGapToLeaderGapToAheadGapOnTrackReferenceDriverId(used by GapOnTrack)-1= use first driver in standings as reference
Setup guide
RaceTowerRowUI (MonoBehaviour)
Location: Assets/RaceTiming/UI/RaceTowerRowUI.cs
Role: Binds a single row of UI.
Inspector
Text references:
- PositionText, NameText, GapText, LapText, RatioText
Visuals:
- TeamColorStrip (Image)
RaceToastBridge (MonoBehaviour)
Location: Assets/RaceTiming/UI/RaceToastBridge.cs
Role: Subscribes to Sirocco Race Timing UnityEvents and shows toast notifications.
Requirements
- A
UnityToast.ToastManagerin the scene.
Inspector
Event filters: - Lap completions, personal bests, session bests - Position changes - Personal best sectors, session best sectors
Also supports optional icons and configurable colors.
DeltaBarUI (MonoBehaviour)
Location: Assets/RaceTiming/UI/DeltaBarUI.cs
Role: Displays a live delta bar overlay showing real-time comparison against a reference lap. Shows whether the driver is faster or slower than the reference at each micro-sector.
Requirements
- A
RaceTimingManagerin the scene. CompetitorFocusManagerfor tracking focused competitor.TrackMarkerScriptableObjectwithMicroSectorsPerSectorconfigured.
Inspector: Configuration
FocusedCompetitorId- Specific competitor ID to track. If 0 (default), uses
CompetitorFocusManager.
Inspector: UI References
DeltaBarImage(Image)- The main bar fill image. Uses Image fill origin to show direction.
DeltaText(TextMeshProUGUI)- Numeric delta display (e.g., "-0.523" or "+1.247").
Inspector: Visuals
FasterColor(Color)- Color for positive delta (driver ahead/faster). Default: Green.
SlowerColor(Color)- Color for negative delta (driver behind/slower). Default: Red.
NeutralColor(Color)- Color for zero delta. Default: White.
MaxDelta- Maximum delta in seconds for full bar fill. Default: 9.999.
How It Works
- Subscribes to
CompetitorFocusManagerto track focused competitor. - Polls
RaceTimingManager.GetDeltaBarData()each frame. - Updates bar fill based on
DeltaBarData.TotalDelta. - Updates text color based on delta sign.
- Hidden when
DeltaBarData.IsActiveis false.
Keyboard Control (Demo)
In demo scenes, press K to toggle delta bar visibility.
LapPositionBarUI (MonoBehaviour)
Location: Assets/RaceTiming/UI/LapPositionBarUI.cs
Role: Displays a horizontal bar overlay showing all competitors as colour-coded dots positioned by their normalised lap progress (0.0–1.0). Provides an at-a-glance view of the field spread around the circuit.
Requirements
- A
RaceTimingManagerin the scene. CompetitorFocusManagerfor identifying the focused competitor.
Inspector: Colors
LeaderColor(Color)- Color for the race leader's dot. Default: Red.
FocusedColor(Color)- Color for the focused competitor's dot. Default: Green.
DefaultColor(Color)- Color for all other competitors' dots. Default: Grey.
Inspector: Pool Settings
InitialPoolSize(int)- Number of dot Images to pre-allocate. Default: 30.
- If more competitors are registered, additional dots are instantiated on demand.
Inspector: Dot Appearance
DotSize(float)- Size of each dot in pixels. Default: 12.
BarHeight(float)- Height of the bar in pixels. Default: 20.
Inspector: UI References
DotContainer(RectTransform)- Container for positioning dots. Auto-created if not assigned.
How It Works
- Queries
LapTimer.QueryTrackPositionIntervals()each frame inLateUpdate(). - Positions each dot horizontally based on
TrackPositionEntry.TrackPosition(0.0–1.0). - Applies colour priority: Focused (green) > Leader (red) > Default (grey).
- Manages a dot pool to avoid per-frame allocations.
- Deactivates unused dots when competitor count decreases.
Keyboard Control (Demo)
In demo scenes, press L to toggle lap position bar visibility.
StartLightsUI (MonoBehaviour)
Location: Assets/RaceTiming/UI/StartLightsUI.cs
Role: Displays F1-style start lights during the session countdown. Subscribes to countdown events on the RaceTimingManager.
Requirements
- A
RaceTimingManagerin the scene. - Configured as part of the
SessionConfigwith a valid countdown.
Inspector: Visuals
- Array of
Imagereferences for the lights.
CarFocusIndicatorUI (MonoBehaviour)
Location: Assets/RaceTiming/UI/CarFocusIndicatorUI.cs
Role: Adds visual brackets on-screen highlighting the currently focused competitor's car on the track. Follows the car's screen position.
Requirements
CompetitorFocusManagerfor tracking focused competitor.
Inspector: Configuration
- Use Team Color: Check to use the focused competitor's team color instead of a static color.
- Highlight Color: Static color fallback.
- Smoothing applied for following.
Keyboard Control (Demo)
In demo scenes, press N to cycle focused competitors.
QualifyingLapUI (MonoBehaviour)
Location: Assets/RaceTiming/UI/QualifyingLapUI.cs
Role: Provides a detailed overlay of sector times and lap splits specifically for the focused car. Highlights best and personal best sectors.
Requirements
- A
RaceTimingManagerin the scene. CompetitorFocusManagerfor identifying the focused competitor.
Inspector: Configurations
- Visual colours for Default, Slower, Personal Best, and Session Best.
Keyboard Control (Demo)
In demo scenes, press Q to toggle qualifying UI visibility.