API Reference
Goal: find the C# method for an action such as spawning a car, requesting a repair or starting a replay. This is a lookup reference for readers who already know how to attach a C# script in Unity.
For Inspector-only setup, return to the guide. For driving inputs from a script, start with Controlling Vehicles from Code.
Find the action you need
| I want my script to… | Section |
|---|---|
| Create a car or choose the player's car | Spawning and registering |
| Enable controls or start the engine | Controlling a vehicle |
| Change transmission or driver assists | Gearbox and driver assists |
| Change camera or take a photo | Camera and photo mode |
| Move a car to a checkpoint | Transport and skidmarks |
| Repair a car | Damage and repair |
| Replay a drive | Instant replay |
| Select a driving preset | Behavior presets |
| React when something happens | Events |
How to read a signature
A signature lists a method's name and the values it needs. For example, SetEngine(RCCP_CarController vehicle, bool engineState) needs a vehicle reference and a true/false value: true starts the engine, false stops it.
- Call the methods through
RCCP, for exampleRCCP.SetEngine(vehicle, true);inside your own method. vehiclemust refer to the car you want to control; it is not a built-in variable.- Returns tells you what you get back.
voidmeans there is no return value;boolmeans true or false. - An overload is another version of the same method with different arguments. Choose the row matching what you need.
- An event is a notification you can listen to, such as a vehicle spawning.
Check: before using a row, you know which object it acts on, what arguments it needs, and whether you must check its result. Read the notes under the table for required modules and timing.
How the facade behaves
RCCP is the main API entry point (sometimes called a facade). It is a static class in the global namespace. RCCP ships no assembly definition file, so it is visible from Assembly-CSharp with no using directive and no assembly reference.
The API checks for missing vehicle references and required components. Many calls log a warning and return when something is missing. Read that warning before changing settings. SpawnRCC logs an error for a missing prefab; IsRepaired is silent and returns true when there is nothing to repair.
Spawning and registering
| Signature | Returns |
|---|---|
SpawnRCC(RCCP_CarController vehiclePrefab, Vector3 position, Quaternion rotation, bool registerAsPlayerVehicle, bool isControllable, bool isEngineRunning) |
RCCP_CarController |
RegisterPlayerVehicle(RCCP_CarController vehicle) |
void |
RegisterPlayerVehicle(RCCP_CarController vehicle, bool isControllable) |
void |
RegisterPlayerVehicle(RCCP_CarController vehicle, bool isControllable, bool engineState) |
void |
DeRegisterPlayerVehicle() |
void |
SpawnRCC returns null and logs an error if the prefab is null. It sets the "never auto-register" flag before instantiating, because RCCP vehicle prefabs ship active and Unity runs OnEnable synchronously inside Instantiate — so registerAsPlayerVehicle: false is honored for both active and inactive prefabs.
Controlling a vehicle
| Signature | Returns |
|---|---|
SetControl(RCCP_CarController vehicle, bool isControllable) |
void |
SetExternalControl(RCCP_CarController vehicle, bool isExternal) |
void |
SetEngine(RCCP_CarController vehicle, bool engineState) |
void |
SetMobileController(RCCP_Settings.MobileController mobileController) |
void |
RCCP_Settings.MobileController is TouchScreen, Gyro, SteeringWheel, Joystick.
Gearbox and driver assists
| Signature | Returns |
|---|---|
SetAutomaticGear(RCCP_CarController vehicle, bool state) |
void |
SetAutomaticGear(RCCP_CarController vehicle, RCCP_Gearbox.TransmissionType transmissionType) |
void |
SetHillStartAssist(RCCP_CarController vehicle, bool state) |
void |
SetCruiseControl(RCCP_CarController vehicle, bool state) |
void |
SetCruiseControl(RCCP_CarController vehicle, bool state, float targetSpeed) |
void |
RCCP_Gearbox.TransmissionType is Manual, Automatic, Automatic_DNRP. The bool overload of SetAutomaticGear maps true to Automatic and false to Manual, so it cannot reach Automatic_DNRP — use the enum overload for that.
targetSpeed is in km/h. All three assist methods require the vehicle's Inputs component; the gearbox methods require its Gearbox.
Camera, photo mode and the crash cinematic
| Signature | Returns |
|---|---|
ChangeCamera() |
void |
EnterPhotoMode() |
void |
ExitPhotoMode() |
void |
CapturePhoto() |
string |
SetPhotoCameraMode(RCCP_PhotoMode.PhotoCameraMode mode) |
void |
CyclePhotoCameraMode() |
void |
SetPhotoFieldOfView(float fieldOfView) |
void |
TriggerCrashCam() |
bool |
CancelCrashCam() |
void |
IsCrashCamActive |
bool (property) |
RCCP_PhotoMode.PhotoCameraMode is Orbit, FreeCam, AutoOrbit; CyclePhotoCameraMode steps through them in that order. CapturePhoto writes a super-size screenshot to persistentDataPath/Photos and returns the file path. SetPhotoFieldOfView takes degrees.
TriggerCrashCam runs the cinematic on the active player vehicle, framed just ahead of the car, and bypasses the delta-v and cooldown gates — an explicit call is an explicit intent. It returns false when there is no scene manager or no active player vehicle. CancelCrashCam is safe to call when nothing is running; IsCrashCamActive does not create the director if one is absent.
Transport and skidmarks
| Signature | Returns |
|---|---|
Transport(Vector3 position, Quaternion rotation) |
void |
Transport(RCCP_CarController vehicle, Vector3 position, Quaternion rotation) |
void |
Transport(RCCP_CarController vehicle, Vector3 position, Quaternion rotation, bool resetVelocity) |
void |
CleanSkidmarks() |
void |
CleanSkidmarks(int index) |
void |
Transport(position, rotation) moves the active player vehicle. The overloads that accept a vehicle move that specific car.
Damage and repair
| Signature | Returns |
|---|---|
Repair(RCCP_CarController carController) |
void |
Repair() |
void |
IsRepaired(RCCP_CarController carController) |
bool |
A repair is a request, not an instant state change: Repair raises repairNow, the damage component consumes it on its next update, and with a deformation solver present the vehicle animates back to shape over several frames. Poll IsRepaired rather than reading the repaired flag yourself — it is not true on the frame the request was made. IsRepaired returns true for a null vehicle and for a vehicle with no damage component, meaning "nothing outstanding". A vehicle deactivated before it returns true keeps its damage, because a disabled component never ticks.
Per-vehicle recording
The per-vehicle recorder stores a clip on one car and plays it back on that same car.
| Signature | Returns |
|---|---|
StartStopRecord(RCCP_CarController vehicle) |
void |
StartStopReplay(RCCP_CarController vehicle) |
void |
StartStopReplay(RCCP_CarController vehicle, RCCP_Recorder.RecordedClip recordedClip) |
void |
StopRecordReplay(RCCP_CarController vehicle) |
void |
These calls require a vehicle with an Other Addons manager and Recorder. Use the vehicle's module tools to add the Recorder before calling them.
Instant replay
The replay director is scene-level and separate from the per-vehicle recorder. Add one via Tools/BoneCracker Games/Realistic Car Controller Pro/Add to Scene/Replay Director.
| Signature | Returns |
|---|---|
StartReplay() |
RCCP_ReplayStartResult |
StopReplay() |
void |
IsReplayActive |
bool (property) |
SaveReplayClip(string name) |
bool |
PlayReplayClip(RCCP_ReplayClip clip) |
RCCP_ReplayStartResult |
ListReplayClips() |
string[] |
StartReplay and PlayReplayClip return NoDirector and log a warning when no director is in the scene. Clips are saved into persistentDataPath/RCCP_Replays with the extension .rccpreplay; characters the file system refuses become _ in the file name, and an existing clip is never overwritten. ListReplayClips returns full paths, newest first, and needs no director. Load a saved clip with RCCP_ReplayClipIO.Load(string path, out RCCP_ReplayClip clip, out string error) before passing it to PlayReplayClip.
RCCP_ReplayStartResult has eight values:
| Value | Meaning |
|---|---|
Started |
The replay is running. |
NoDirector |
No replay director in the scene. |
Multiplayer |
Replays are not available in multiplayer sessions. |
BufferTooShort |
Less than one second is recorded or playable. |
AlreadyActive |
A replay is already running. |
PhotoModeActive |
Photo mode must be exited first. |
LegacyRecorderBusy |
A per-vehicle recorder on a recorded car is recording or playing. |
Failed |
Anything else; read RCCP_ReplayDirector.Current.LastStartMessage for the reason. |
LastStartMessage also carries detail for the non-Failed outcomes, including which of a clip's vehicles were skipped for having no scene car and no matching entry in the director's Clip Vehicle Prefabs.
Behavior presets
| Signature | Returns |
|---|---|
SetBehavior(int behaviorIndex) |
void |
SetBehavior(string behaviorName) |
void |
ClearBehavior() |
void |
GetBehaviorIndexByName(string behaviorName) |
int |
GetBehaviorByName(string behaviorName) |
RCCP_Settings.BehaviorType |
The index is into RCCP_Settings.behaviorTypes. Name lookups are case-insensitive; GetBehaviorIndexByName returns -1 and GetBehaviorByName returns null when there is no match, and the string overload of SetBehavior logs a warning and does nothing on a miss.
ClearBehavior turns overrideBehavior back off so global preset changes stop reaching vehicles. It does not revert values a preset already wrote — cars retain whatever is currently applied.
Audio routing
| Signature | Returns |
|---|---|
SetAudioOutputBus(AudioMixerGroup hostGroup) |
bool |
ClearAudioOutputBus() |
void |
Call SetAudioOutputBus once at boot with a group from your own mixer to route all RCCP vehicle audio through it. RCCP's mixer is nested underneath the supplied group rather than bypassed, which keeps the exposed pitch parameter the crash cinematic drives intact. Passing null, or calling ClearAudioOutputBus, restores the default of feeding the audio listener directly.
Events
The events in RCCP_Events are static. Static events survive scene loads and outlive your objects, so unsubscribe in OnDisable — a subscriber that is destroyed without unsubscribing keeps the handler alive and throws on the next dispatch.
void OnEnable() {
RCCP_Events.OnRCCPSpawned += VehicleSpawned;
}
void OnDisable() {
RCCP_Events.OnRCCPSpawned -= VehicleSpawned;
}
void VehicleSpawned(RCCP_CarController vehicle) { }
Lifecycle
| Event | Handler signature |
|---|---|
OnRCCPSpawned |
(RCCP_CarController rccp) |
OnRCCPDestroyed |
(RCCP_CarController rccp) |
OnRCCPAISpawned |
(RCCP_CarController rccp) |
OnRCCPAIDestroyed |
(RCCP_CarController rccp) |
OnRCCPCameraSpawned |
(RCCP_Camera cam) |
OnRCCPUISpawned |
(RCCP_UIManager UI) |
OnRCCPUIDestroyed |
(RCCP_UIManager UI) |
OnVehicleChanged |
() |
OnVehicleChangedToVehicle |
(RCCP_CarController carController) |
OnBehaviorChanged |
() |
OnRCCPUIInformer |
(string text) |
OnRCCPDestroyed and OnRCCPAIDestroyed fire when a vehicle is destroyed or disabled.
Collisions and damage
| Event | Handler signature |
|---|---|
OnRCCPCollision |
(RCCP_CarController rccp, Collision collision) |
OnRCCPCollisionEnter |
(RCCP_CarController rccp, Collision collision) |
OnRCCPImpact |
(RCCP_CarController rccp, float impulse) |
OnRCCPDamaged |
(RCCP_CarController rccp) |
OnRCCPRepaired |
(RCCP_CarController rccp) |
OnRCCPZoneDamaged |
(RCCP_CarController rccp, RCCP_DamageZone zone, float health01) |
OnRCCPPartDetached |
(RCCP_CarController rccp, RCCP_DetachablePart part) |
OnRCCPWheelDetached |
(RCCP_CarController rccp, RCCP_WheelCollider wheel) |
OnRCCPLightBroken |
(RCCP_CarController rccp, RCCP_Light light) |
OnRCCPCaughtFire |
(RCCP_CarController rccp) |
Three of these look interchangeable and are not:
| Event | When |
|---|---|
OnRCCPCollision |
Every contact, including collision stay. This is what damage and particles run on. |
OnRCCPCollisionEnter |
Once per collision enter, before any damage is applied. Identifies the start of an impact. |
OnRCCPImpact |
Debounced by a per-vehicle cooldown and a minimum impulse. Use this for gameplay — sound stingers, score, UI shake. |
RCCP_DamageZone is Front, Rear, Left, Right; health01 is 0 to 1 where 1 is intact. OnRCCPCaughtFire requires the damage mechanics addon on the vehicle.
Fuel, boost and cinematics
| Event | Handler signature |
|---|---|
OnRCCPFuelEmpty |
(RCCP_CarController rccp) |
OnRCCPNosEmpty |
(RCCP_CarController rccp) |
OnRCCPReplayStarted |
() |
OnRCCPReplayEnded |
() |
OnRCCPCrashCamStarted |
(RCCP_CarController rccp, Vector3 impactPoint) |
OnRCCPCrashCamEnded |
(RCCP_CarController rccp) |
OnRCCPFuelEmpty and OnRCCPNosEmpty fire once and re-arm on refill or regeneration. OnRCCPReplayStarted fires after the live world is frozen and OnRCCPReplayEnded after it is restored. OnRCCPCrashCamEnded fires on every exit path, including cancellation.
Raising events yourself
Each event has a matching Event_* static method that raises it — Event_OnRCCPSpawned, Event_OnRCCPImpact and so on. These exist so RCCP's own components can fire events they do not own; calling them from game code fakes a notification that did not happen and will desynchronize anything listening.
Common mistakes
| What | Why |
|---|---|
| Reading the damage component's repaired flag directly | It is false for the whole multi-frame repair animation. Poll IsRepaired instead. |
Turning off canControl while trying to drive from a script |
It also blocks scripted and AI inputs. Keep it on and enable externalControl for a scripted driver. To stop an AI, stop its driver or have it request braking. |
SetAutomaticGear with a bool to get the DNRP selector |
The bool overload only reaches Manual and Automatic. Pass the enum. |
Calling StartReplay and assuming it worked |
It returns a result for a reason; seven of its eight values mean it did not start. |
Calling the Event_* methods |
They raise events, not observe them. |
Read next
- Scripting Reference — worked examples of driving a vehicle from code, rather than a member list.
- Architecture Reference — which component owns what, and the execution order the events fire in.
- Field Reference — every serialized setting on every component, with defaults and ranges.
- Replay and Recording — what the replay director does and how to set one up before calling into it.