Component Reference
This reference covers the key Sirocco Race Timing components, their roles, and their main Inspector fields.
RaceTimingManager (MonoBehaviour)
Location: Assets/SlowToastRacing/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/SlowToastRacing/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 → Race Timing → Session Config
Inspector: Performance
StandingsUpdateIntervalSeconds- Interval in seconds between standings sorting operations. Default: 0.1s (10 Hz). Increase to reduce CPU cost; decrease for more responsive position display.
StationarySpeedThreshold- Speed in m/s below which a competitor is considered stationary for gap calculation. Default: 3.0 m/s (~11 km/h). When stationary, gap times freeze to prevent inflation. Does NOT affect lap/sector timing.
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 (TrackMarkersSO) 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
- Countdown events: OnCountdownStartedUnity, OnPreStartTickUnity, OnLightActivatedUnity, OnLightsOutUnity
- Penalty events: OnTimePenaltyIssuedUnity, OnTimePenaltyCancelledUnity, OnDisqualificationUnity, OnDisqualificationRevokedUnity, OnLapInvalidatedUnity, OnLapRevalidatedUnity
- Lifecycle events: OnCompetitorDisconnected, OnCompetitorReconnected, OnCompetitorWithdrawn
API
- Start session:
RaceTimingManager.Instance.StartSession() - Stop session:
RaceTimingManager.Instance.StopSession() - Restart session:
RaceTimingManager.Instance.RestartSession() - Access Core:
RaceTimingManager.Instance.LapTimer - Delta bar:
LapTimer.GetDeltaBarData(competitorId),LapTimer.SetReferenceLap(competitorId, MicroSectorLapRecord) - Competitor management:
RegisterCompetitor(RaceCompetitor),DisconnectCompetitor(competitorId),TryReconnectCompetitor(RaceCompetitor),WithdrawCompetitor(competitorId) - Countdown:
StartCountdown(StartLightsConfig) - Runtime config:
SetTargetLapCount(),SetTimedSession(),ClearFinishCondition(),SetCountdownEnabled(),SetCountdownConfig(),SetDeltaBarConfig()
Pausing the Timing System
Sirocco Race Timing automatically respects Unity's Time.timeScale. To pause the race and all timing calculations, simply set Time.timeScale = 0f. When you unpause by setting Time.timeScale = 1f, all timers (lap times, session time, gap calculations) will resume exactly where they left off without any inflation or errors.
SessionConfigAsset (ScriptableObject)
Location: Assets/SlowToastRacing/RaceTiming/Adapter/SessionConfigAsset.cs
Role: Holds all session settings in one asset: identity, countdown, and finish condition. Assign to RaceTimingManager.SessionConfig.
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 → Race Timing → Session Config
- Set session identity (name and type label)
- Configure countdown and finish condition
- Assign to
RaceTimingManager.SessionConfig
RaceCompetitor (MonoBehaviour)
Location: Assets/SlowToastRacing/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(). PersistentId- Stable ID that survives GameObject destruction/recreation. When non-zero, overrides
Idfor reconnection scenarios (e.g., network player ID). WithdrawOnDisable- If true, the competitor is permanently withdrawn when the GameObject is disabled. If false (default), the competitor is disconnected, preserving data for reconnection.
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
TrackMarkerManagerBehaviourat runtime. Not exposed in the Inspector.
Behavior
- Runs timing updates in FixedUpdate for deterministic, physics-aligned sampling.
- Uses track markers (when present) to compute a track ratio (0–1) and detect lap crossings.
- Falls back to Euclidean distance accumulation if no track markers are found.
TrackMarkerManagerBehaviour (MonoBehaviour)
Location: Assets/SlowToastRacing/RaceTiming/Adapter/TrackMarkerManagerBehaviour.cs
Role: Unity wrapper around Core track marker management. Also draws gizmos and sector boundary markers.
Inspector
Track Marker Scriptable Object- 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/SlowToastRacing/RaceTiming/UI/RaceTowerUI.cs
Role: Displays a standings tower. Polls session data each Update.
Inspector: Positioning
Exposes standard RectTransform properties for easy placement without editing the prefab:
- Anchor Min / Anchor Max, Pivot, Anchored Position
Inspector
RowPrefab:RaceTowerRowUIprefabContainer: Transform under a Canvas hierarchy (often with a layout group)Mode: gap display mode (default:GapOnTrack)GapToLeaderGapToAheadGapOnTrackGapToBestLapReferenceDriverId(used by GapOnTrack)-1= use first driver in standings as reference
Setup guide
RaceTowerRowUI (MonoBehaviour)
Location: Assets/SlowToastRacing/RaceTiming/UI/RaceTowerRowUI.cs
Role: Binds one row in the Race Tower.
Inspector
Text references:
- PositionText, NameText, GapText, LapText, RatioText
Visuals:
- TeamColorStrip (Image)
RaceToastBridge (MonoBehaviour)
Location: Assets/SlowToastRacing/RaceTiming/UI/RaceToastBridge.cs
Role: Subscribes to Sirocco Race Timing UnityEvents and shows toast notifications.
Requirements
- A
SiroccoToast.ToastManagerin the scene.
Inspector
Event filter toggles (defaults described in the toasts guide): - Lap completions, personal bests, session bests - Position changes, penalty events - Personal best sectors, session best sectors
Also supports optional toast icons and configurable colours.
DeltaBarUI (MonoBehaviour)
Location: Assets/SlowToastRacing/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.TrackMarkersSOwithMicroSectorsPerSectorconfigured.
Inspector: Configuration
FocusedCompetitorId- Specific competitor ID to track. If 0 (default), uses
CompetitorFocusManager.
Inspector: Positioning
These components expose standard RectTransform properties, allowing you to easily place and scale the UI without modifying the prefab contents:
- Anchor Min / Anchor Max
- Pivot
- Anchored Position
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 the focused driver. - Polls
LapTimer.GetDeltaBarData()each frame. - Updates bar fill based on
DeltaBarData.TotalDelta. - Hidden when
DeltaBarData.IsActiveis false.
Keyboard shortcut (Demo)
Press K to toggle visibility.
LapPositionBarUI (MonoBehaviour)
Location: Assets/SlowToastRacing/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: Positioning
These components expose standard RectTransform properties, allowing you to easily place and scale the UI without modifying the prefab contents:
- Anchor Min / Anchor Max
- Pivot
- Anchored Position
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 track progress (0–1).
- Colour priority: focused driver (Green) > leader (Red) > others (Grey).
- Uses a dot pool to avoid per-frame allocations.
Keyboard shortcut (Demo)
Press L to toggle visibility.
StartLightsUI (MonoBehaviour)
Location: Assets/SlowToastRacing/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: Positioning
These components expose standard RectTransform properties, allowing you to easily place and scale the UI without modifying the prefab contents:
- Anchor Min / Anchor Max
- Pivot
- Anchored Position
Inspector: Visuals
- Array of
Imagereferences for the lights.
CarFocusIndicatorUI (MonoBehaviour)
Location: Assets/SlowToastRacing/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: Positioning
These components expose standard RectTransform properties, allowing you to easily place and scale the UI without modifying the prefab contents:
- Anchor Min / Anchor Max
- Pivot
- Anchored Position
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 shortcut (Demo)
Press N to cycle focused competitors.
QualifyingLapUI (MonoBehaviour)
Location: Assets/SlowToastRacing/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: Positioning
These components expose standard RectTransform properties, allowing you to easily place and scale the UI without modifying the prefab contents:
- Anchor Min / Anchor Max
- Pivot
- Anchored Position
Inspector
- Visual colours: Default, Slower, Personal Best, Session Best.
Keyboard shortcut (Demo)
Press Q to toggle visibility.
SessionInfoHeaderUI (MonoBehaviour)
Location: Assets/SlowToastRacing/RaceTiming/UI/SessionInfoHeaderUI.cs
Role: Displays session progress information in the UI (such as laps completed or time remaining) based on the active session's finish condition. Highlights when a session is near completion or has expired.
Requirements
- Typically driven by
RaceTimingManageror UI controllers that passSessionProgressdata.
Inspector: UI Elements
ProgressText(TextMeshProUGUI)- Text element to display the progress string.
CheckeredFlagIcon(Image)- Icon shown when the session is near its end or finished.
DividerLine(GameObject)- Optional visual divider.
Inspector: Styling
NormalTextColor(Color)- Default text colour.
NearEndTextColor(Color)- Text colour when approaching the finish condition (e.g., last lap or under 5 minutes). Default: Yellow tint.
ExpiredTextColor(Color)- Text colour when the session has finished/expired. Default: Red.
CompetitorFocusManager (MonoBehaviour)
Location: Assets/SlowToastRacing/RaceTiming/Adapter/CompetitorFocusManager.cs
Role: Centralised singleton manager that tracks which competitor ID is currently "focused" by the UI and camera systems.
Inspector
No serialized fields. Place this on a manager GameObject in your scene.
API Usage
- Get focus:
CompetitorFocusManager.Instance.FocusedCompetitorId - Set focus:
CompetitorFocusManager.Instance.SetFocus(competitorId) - Cycle focus:
CompetitorFocusManager.Instance.FocusNext() - Events:
OnFocusChangedfired when the focus changes.