Drift Challenge
Score points for controlled slides in an RCCP 2 vehicle.
Install the module
If you imported the complete Driving Sandbox, this module is already installed. Go to the next section. Use these steps only for RCCP2-Drift.unitypackage, made with Export Module > Drift.
- If any required packages are missing, install Input System, Editor Coroutines and Unity UI in Package Manager.
- Install Realistic Car Controller Pro 2 v4.1.3 or later. The RCCP 2 installer stops if a required package is missing.
- Open Edit > Project Settings > Player > Other Settings.
- Set Active Input Handling to Input System Package (New) or Both.
- If Unity requests a restart, restart the Editor.
- If TMP Essential Resources are missing, select Window > TextMeshPro > Import TMP Essential Resources.
- Use Assets > Import Package > Custom Package to import
RCCP2-Drift.unitypackage.
Drive the example
| No. | Item |
|---|---|
| 1 | RCCP dashboard: speed, gear and engine RPM |
| 2 | Score, combo and remaining time |
| 3 | Personal best |
| 4 | Driving guidance |
| 5 | Start Run button. The label changes to Retry. |
| 6 | INFO button |
- Open
Assets/RCCP 2 Driving Sandbox/Modules/Drift/Samples/Drift Example.unity. - Enter Play Mode.
- Read the driving instructions in the HUD. Select Start Run when ready.
- Use W to build speed toward the marked right turn. Steer right with D and tap Space to start a slide.
- Follow the HUD feedback. Keep the vehicle moving forward and sideways on the ground to score.
- After the first turn, follow the yellow arrows and the TURN signs. The example course is a closed circuit with five left turns that lead back to the start arch.
- At the end, compare RUN SCORE with PERSONAL BEST.
- Select Retry to start another run. The vehicle returns to the start position. The personal best stays visible.
Select INFO in the sample to see the controls, rules and setup steps.
Task result feedback
The HUD shows a green banner when the run ends. The animated score panel keeps the result until you select Retry.
The banner stays fully visible for 3 seconds between fades. A new attempt hides the banner sooner. Play continues during the banner. You can use the HUD buttons while the banner is visible.
The supplied HUD has a Result Notification reference. Clear Result Notification to hide the banner and keep the standard HUD. Keep the included Shared/UI/SandboxTaskNotification.cs script in the project when you use the HUD.
Controls
| Action | Key |
|---|---|
| Throttle | W or Up Arrow |
| Brake and reverse | S or Down Arrow |
| Steer | A / D or Left / Right Arrow |
| Handbrake | Space |
Use it in your scene
If you use the complete Driving Sandbox, open your scene. Select your RCCP vehicle in the Hierarchy. On the Drift card, select Add to Scene.
Add a driving surface with a collider if the scene needs one. In Play Mode, select Start Run. If the vehicle does not slide, see Vehicle behavior. Complete any other steps in the setup dialog.
In a single module package, or to do it manually, use these steps.
Before you start, prepare a scene with a solid driving surface. To test, drag Assets/Realistic Car Controller Pro 2/Prefabs/Prototype/RCCP_Sedan01.prefab into the scene. Place the Sedan about 0.7 m above the surface.
To add a driving camera, select Tools > BoneCracker Games > Realistic Car Controller Pro 2 > Add to Scene > RCCP Camera. Then disable the original Main Camera. For the dashboard, select Tools > BoneCracker Games > Realistic Car Controller Pro 2 > Add to Scene > UI Canvas.
If the scene has no RCCP Scene Manager, select Tools > BoneCracker Games > Realistic Car Controller Pro 2 > Add to Scene > Scene Manager. If the scene has more than one vehicle, assign your vehicle to Active Player Vehicle on RCCP Scene Manager. Clear Register Last Vehicle As Player. If this option is on, the last eligible vehicle can take the player slot at startup.
- Add
Assets/RCCP 2 Driving Sandbox/Modules/Drift/Prefabs/Drift Challenge.prefabto your scene. - Drag your RCCP vehicle from the Hierarchy to Vehicle.
- If
RCCP.SpawnRCCcreates the vehicle at runtime, leave Start On Play off. After the challenge starts, setVehicleand callStartRun(). - If you use the supplied HUD, select Start Run to start the run. Without the HUD, enable Start On Play or call
StartRun(). - To show the score, add
Assets/RCCP 2 Driving Sandbox/Modules/Drift/Prefabs/Drift HUD.prefab. - Drag the drift challenge to Challenge on the HUD.
- Put the vehicle at its start pose. Create an empty GameObject with the position and rotation of the vehicle root. Keep the spawn at the vehicle root height. Assign the object to Retry Spawn on the HUD. Start Run and Retry move the vehicle to this pose.
- If the scene has no EventSystem, select GameObject > UI > Event System. Use an Input System UI Input Module on the EventSystem.
- To connect the result to your game, use On Run Finished on the challenge. Read
Score,BestScoreandNewPersonalBestin your handler.
Copy Settings/Drift Pilot Settings.asset to change the duration and thresholds. Assign the copy to Settings on the challenge. Save prefab overrides in your scene or in a prefab variant.
The INFO button, the course, the track props in Samples/Drift Art/Track Kit/ and Samples/Drift Sedan.prefab are part of the sample only.
Vehicle behavior
The sample sedan uses the RCCP Drift behavior preset. On the sedan, Use a vehicle-specific preset is on and Preset is Drift. If the HUD keeps showing "Increase the slide. Steer and briefly tap Space.", do one of these steps:
- On your vehicle, clear Ignore behavior presets. Enable Use a vehicle-specific preset and set Preset to Drift.
- In your copy of the Drift Settings, decrease Minimum Angle.
Tune scoring in the Inspector
Select the Drift Settings asset assigned to the challenge. Start a new run after you change a setting.
| Section | Setting | Sample value |
|---|---|---|
| Run | Duration | 60 seconds |
| Valid Drift | Minimum speed and slip angle range | 25 km/h and 15–60 degrees |
| Scoring | Points per second at the maximum angle and 1× combo | 100 |
| Combo | Step, maximum, interval and grace | +0.25×, 2×, 2 seconds and 0.35 seconds |
| Personal Best | ID for the local record | drift-example |
Use a unique Personal Best Id for each course or set of scoring rules. The challenge uses this ID to save the record on the current device. Clear the field to keep the record for the lifetime of the challenge.
The record uses whole points from completed runs. Replay time does not count. While an RCCP replay plays, the clock and the score stop, and Start Run and Retry do nothing.
Script reference
Add using BoneCrackerGames; and using BoneCrackerGames.DrivingSandbox.Drift; to your script.
| Member | Purpose |
|---|---|
DriftChallenge.StartRun() |
Starts a new run on the assigned vehicle. It resets the time, score and combo. |
DriftChallenge.ResetRun() |
Stops the run and restores the starting time, score and combo. |
DriftChallenge.Vehicle |
Gets or sets the measured vehicle. Setting it stops the current run. |
DriftChallenge.Score |
Score of the current or last run. |
DriftChallenge.Combo |
Current combo multiplier. |
DriftChallenge.RemainingSeconds |
Time left in the current run. |
DriftChallenge.IsRunning |
True while a run is active. |
DriftChallenge.Finished |
True after the run time ends, until the next reset or run. |
DriftChallenge.BestScore |
Personal best in whole points. |
DriftChallenge.NewPersonalBest |
True after a completed run sets a new personal best, until the next reset or run. |
DriftChallenge.OnRunFinished |
Event raised once when the run time ends. |
DriftSettings properties |
Read the saved values: Duration, MinimumSpeedKph, MinimumAngle, MaximumAngle, PointsPerSecond, ComboStep, MaxCombo, ComboInterval, ComboGrace and PersonalBestId. |
DriftHUD.Retry() |
Moves the vehicle to Retry Spawn if assigned, then calls StartRun(). |
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Another vehicle responds to the keys. | Register Last Vehicle As Player is on, or Active Player Vehicle points to another vehicle. | Assign your vehicle to Active Player Vehicle. Clear Register Last Vehicle As Player. |
| The HUD shows "ASSIGN THE CHALLENGE ON THIS HUD". | Challenge on the HUD is empty. | Drag the Drift Challenge from the Hierarchy to Challenge. |
| Start Run does nothing, and the Console shows "Vehicle is not assigned". | Vehicle on the challenge is empty. | Drag the RCCP vehicle from the Hierarchy to Vehicle. |
| The Console shows "Vehicle refers to a prefab asset". | Vehicle points to a prefab in the Project window. | Drag the vehicle instance from the Hierarchy to Vehicle. |
| The HUD keeps showing "Increase the slide. Steer and briefly tap Space." | The vehicle does not reach Minimum Angle. | Use the Drift preset on the vehicle, or decrease Minimum Angle. See Vehicle behavior. |
| The Start Run button cannot be selected. | The EventSystem or its Input System UI Input Module is missing. | Add the missing object or component. |
| Two courses share one personal best. | The Drift Settings copies use the same Personal Best Id. | Give each copy a unique Personal Best Id. |










