API Reference

Table of Contents

This document covers every public method in the RCCP static class and every event in RCCP_Events. These are the two primary entry points you will use when integrating Realistic Car Controller Pro into your own game scripts.


Overview

RCCP is a static utility class. You do not need to create an instance or attach it to a GameObject. Call any method directly:


RCCP.MethodName();

Every script that calls the RCCP API should include the following at the top:


using UnityEngine;

No additional using statements are required because RCCP uses the global namespace.

Key points:


Vehicle Spawning and Registration

These methods handle instantiating vehicle prefabs at runtime and telling the system which vehicle the player is currently driving.

SpawnRCC

Instantiates a vehicle prefab, activates it, and optionally registers it as the player vehicle.


public static RCCP_CarController SpawnRCC(
    RCCP_CarController vehiclePrefab,
    Vector3 position,
    Quaternion rotation,
    bool registerAsPlayerVehicle,
    bool isControllable,
    bool isEngineRunning
)
ParameterTypeDescription
vehiclePrefabRCCP_CarControllerThe vehicle prefab to instantiate. Must have an RCCP_CarController component.
positionVector3World position where the vehicle will spawn.
rotationQuaternionWorld rotation applied to the spawned vehicle.
registerAsPlayerVehicleboolIf true, the spawned vehicle becomes the active player vehicle immediately.
isControllableboolIf true, the player can control this vehicle right away.
isEngineRunningboolIf true, the engine starts running immediately. If false, the engine is killed.

Returns: The spawned RCCP_CarController instance.


// Spawn a car at the origin, register as player, controllable, engine on
public RCCP_CarController carPrefab;

void Start() {
    RCCP_CarController spawnedCar = RCCP.SpawnRCC(
        carPrefab,
        Vector3.zero,
        Quaternion.identity,
        true,   // register as player vehicle
        true,   // player can control it
        true    // engine starts running
    );
}

RegisterPlayerVehicle

Registers an existing vehicle as the active player vehicle. The RCCP camera and UI will follow this vehicle. There are three overloads.

Overload 1 -- Vehicle only:


public static void RegisterPlayerVehicle(RCCP_CarController vehicle)

Registers the vehicle with its current controllable and engine states unchanged.


// Register an already-spawned vehicle as the player vehicle
RCCP.RegisterPlayerVehicle(myVehicle);

Overload 2 -- Vehicle with controllable state:


public static void RegisterPlayerVehicle(RCCP_CarController vehicle, bool isControllable)
ParameterTypeDescription
vehicleRCCP_CarControllerThe vehicle to register.
isControllableboolIf true, enables player control. If false, disables it.

// Register vehicle and enable player control
RCCP.RegisterPlayerVehicle(myVehicle, true);

Overload 3 -- Vehicle with controllable and engine state:


public static void RegisterPlayerVehicle(RCCP_CarController vehicle, bool isControllable, bool engineState)
ParameterTypeDescription
vehicleRCCP_CarControllerThe vehicle to register.
isControllableboolIf true, enables player control.
engineStateboolIf true, starts the engine. If false, kills it.

// Register vehicle, enable control, and start the engine
RCCP.RegisterPlayerVehicle(myVehicle, true, true);

DeRegisterPlayerVehicle

Removes the current player vehicle registration. The camera and UI will no longer follow any vehicle.


public static void DeRegisterPlayerVehicle()

Takes no parameters.


// Player exits the car -- deregister so camera stops following
RCCP.DeRegisterPlayerVehicle();

Vehicle Control

These methods control whether a vehicle accepts player input and whether its engine is running.

SetControl

Enables or disables player control of a vehicle. When disabled, player inputs are zeroed and brakes are applied automatically.


public static void SetControl(RCCP_CarController vehicle, bool isControllable)
ParameterTypeDescription
vehicleRCCP_CarControllerTarget vehicle.
isControllablebooltrue to enable player input, false to disable it.

// Disable player control during a cutscene
RCCP.SetControl(playerCar, false);

// Re-enable after the cutscene
RCCP.SetControl(playerCar, true);

SetExternalControl

Marks a vehicle as being driven by an external controller (AI, network, replay). When true, the vehicle's input component ignores the player input manager and instead uses override inputs.


public static void SetExternalControl(RCCP_CarController vehicle, bool isExternal)
ParameterTypeDescription
vehicleRCCP_CarControllerTarget vehicle.
isExternalbooltrue to mark as externally controlled, false to return to player control.

// Hand control to an AI driver
RCCP.SetExternalControl(aiCar, true);

// Return to player control
RCCP.SetExternalControl(aiCar, false);

Note: This method performs a null check. If vehicle is null, it returns silently.

SetEngine

Starts or stops the vehicle engine.


public static void SetEngine(RCCP_CarController vehicle, bool engineState)
ParameterTypeDescription
vehicleRCCP_CarControllerTarget vehicle.
engineStatebooltrue to start the engine, false to kill it.

// Start the engine
RCCP.SetEngine(playerCar, true);

// Kill the engine (e.g., player parked the car)
RCCP.SetEngine(playerCar, false);

SetAutomaticGear

Sets the vehicle's transmission type. There are two overloads.

Overload 1 -- Boolean (Automatic or Manual):


public static void SetAutomaticGear(RCCP_CarController vehicle, bool state)
ParameterTypeDescription
vehicleRCCP_CarControllerTarget vehicle.
statebooltrue = Automatic, false = Manual.

// Switch to automatic transmission
RCCP.SetAutomaticGear(playerCar, true);

Overload 2 -- TransmissionType enum:


public static void SetAutomaticGear(RCCP_CarController vehicle, RCCP_Gearbox.TransmissionType transmissionType)
ParameterTypeDescription
vehicleRCCP_CarControllerTarget vehicle.
transmissionTypeRCCP_Gearbox.TransmissionTypeOne of: Manual, Automatic, Automatic_DNRP.

The Automatic_DNRP option adds a Drive/Neutral/Reverse/Park selector, similar to real automatic cars.


// Switch to DNRP automatic mode
RCCP.SetAutomaticGear(playerCar, RCCP_Gearbox.TransmissionType.Automatic_DNRP);

Note: Both overloads check whether the vehicle has a Gearbox component. If it does not, the call is ignored.


Camera

ChangeCamera

Cycles through the available camera modes on the RCCP camera (TPS, FPS, Top-Down, etc.).


public static void ChangeCamera()

Takes no parameters. Operates through RCCP_SceneManager.Instance.


// Bind to a UI button to let the player cycle camera views
public void OnCameraButtonPressed() {
    RCCP.ChangeCamera();
}

For more details on available camera modes, see Camera System.


Transport

Teleports a vehicle to a new position and rotation. Useful for respawning after going off-track or for checkpoint systems.

Transport (Player Vehicle)

Transports the currently registered player vehicle.


public static void Transport(Vector3 position, Quaternion rotation)
ParameterTypeDescription
positionVector3World position to move the vehicle to.
rotationQuaternionWorld rotation to apply.

// Respawn the player car at the last checkpoint
RCCP.Transport(checkpointPosition, checkpointRotation);

Transport (Specific Vehicle)

Transports a specific vehicle.


public static void Transport(RCCP_CarController vehicle, Vector3 position, Quaternion rotation)
ParameterTypeDescription
vehicleRCCP_CarControllerThe vehicle to transport.
positionVector3World position to move the vehicle to.
rotationQuaternionWorld rotation to apply.

// Transport a specific AI vehicle to a new position
RCCP.Transport(aiCar, spawnPoint.position, spawnPoint.rotation);

Transport (With Velocity Reset)

Transports a specific vehicle and optionally resets its velocity so it does not continue sliding after teleport.


public static void Transport(RCCP_CarController vehicle, Vector3 position, Quaternion rotation, bool resetVelocity)
ParameterTypeDescription
vehicleRCCP_CarControllerThe vehicle to transport.
positionVector3World position to move the vehicle to.
rotationQuaternionWorld rotation to apply.
resetVelocityboolIf true, resets the Rigidbody velocity after transport.

// Transport and stop the car completely
RCCP.Transport(playerCar, respawnPos, respawnRot, true);

Behavior

Behavior presets let you change how all vehicles handle at runtime (e.g., switching between "Sim" and "Arcade" modes). Presets are configured in the RCCP Settings asset. See Settings for how to create behavior presets.

SetBehavior (By Index)

Applies a behavior preset by its index in the RCCP_Settings.behaviorTypes array.


public static void SetBehavior(int behaviorIndex)
ParameterTypeDescription
behaviorIndexintZero-based index into the behavior presets array in RCCP Settings.

// Apply the first behavior preset
RCCP.SetBehavior(0);

SetBehavior (By Name)

Applies a behavior preset by its name. The name comparison is case-insensitive.


public static void SetBehavior(string behaviorName)
ParameterTypeDescription
behaviorNamestringName of the behavior preset. Case-insensitive.

// Switch to the "Drift" behavior preset
RCCP.SetBehavior("Drift");

If no preset with the given name is found, a warning is logged to the console and no change is made.

GetBehaviorIndexByName

Returns the index of a behavior preset by its name, or -1 if not found.


public static int GetBehaviorIndexByName(string behaviorName)
ParameterTypeDescription
behaviorNamestringName of the behavior preset. Case-insensitive.

Returns: The zero-based index of the preset, or -1 if no match is found.


int driftIndex = RCCP.GetBehaviorIndexByName("Drift");

if (driftIndex >= 0)
    Debug.Log("Drift preset is at index " + driftIndex);
else
    Debug.Log("Drift preset not found!");

GetBehaviorByName

Returns the full BehaviorType object for a preset, or null if not found.


public static RCCP_Settings.BehaviorType GetBehaviorByName(string behaviorName)
ParameterTypeDescription
behaviorNamestringName of the behavior preset. Case-insensitive.

Returns: The matching RCCP_Settings.BehaviorType object, or null.


RCCP_Settings.BehaviorType simBehavior = RCCP.GetBehaviorByName("Sim");

if (simBehavior != null)
    Debug.Log("Found behavior: " + simBehavior.behaviorName);

Mobile Input

SetMobileController

Changes the active mobile input method at runtime. Use this to let players switch between touch controls, gyroscope, steering wheel UI, or joystick.


public static void SetMobileController(RCCP_Settings.MobileController mobileController)
ParameterTypeDescription
mobileControllerRCCP_Settings.MobileControllerOne of: TouchScreen, Gyro, SteeringWheel, Joystick.

// Switch to gyroscope controls
RCCP.SetMobileController(RCCP_Settings.MobileController.Gyro);

// Switch to on-screen joystick
RCCP.SetMobileController(RCCP_Settings.MobileController.Joystick);

For more details on mobile controls, see Mobile.


Recording

These methods control the vehicle recording and replay system. The vehicle must have an RCCP_Recorder component attached through the OtherAddonsManager. See Recording and Playback for setup instructions.

All recording methods perform null checks on the OtherAddonsManager and Recorder components. If either is missing, the call is silently ignored.

StartStopRecord

Toggles recording on or off for the specified vehicle. Call once to start recording, call again to stop.


public static void StartStopRecord(RCCP_CarController vehicle)
ParameterTypeDescription
vehicleRCCP_CarControllerTarget vehicle to record.

// Toggle recording with a button press
public void OnRecordButton() {
    RCCP.StartStopRecord(playerCar);
}

StartStopReplay (Last Recording)

Toggles replay of the most recent recording. Call once to start replay, call again to stop.


public static void StartStopReplay(RCCP_CarController vehicle)
ParameterTypeDescription
vehicleRCCP_CarControllerTarget vehicle to replay.

// Replay the last recorded run
RCCP.StartStopReplay(playerCar);

StartStopReplay (Specific Recording)

Toggles replay of a specific recorded clip.


public static void StartStopReplay(RCCP_CarController vehicle, RCCP_Recorder.RecordedClip recordedClip)
ParameterTypeDescription
vehicleRCCP_CarControllerTarget vehicle to replay.
recordedClipRCCP_Recorder.RecordedClipThe specific recorded clip to play back.

// Play a specific recorded ghost lap
RCCP.StartStopReplay(ghostCar, savedGhostClip);

StopRecordReplay

Stops any active recording or replay on the vehicle.


public static void StopRecordReplay(RCCP_CarController vehicle)
ParameterTypeDescription
vehicleRCCP_CarControllerTarget vehicle to stop recording or replaying.

// Force stop all recording/replay
RCCP.StopRecordReplay(playerCar);

Maintenance

Repair (Specific Vehicle)

Triggers a repair on the specified vehicle, restoring all damage.


public static void Repair(RCCP_CarController carController)
ParameterTypeDescription
carControllerRCCP_CarControllerThe vehicle to repair.

// Repair a specific vehicle
RCCP.Repair(playerCar);

Repair (Player Vehicle)

Repairs the currently registered player vehicle. If no player vehicle is registered, this method does nothing.


public static void Repair()

Takes no parameters.


// Repair the current player car (e.g., from a UI button)
RCCP.Repair();

CleanSkidmarks (All)

Removes all skidmarks from the current scene.


public static void CleanSkidmarks()

Takes no parameters.


// Clean up all tire marks (e.g., on scene reset)
RCCP.CleanSkidmarks();

CleanSkidmarks (By Index)

Removes a specific set of skidmarks by index.


public static void CleanSkidmarks(int index)
ParameterTypeDescription
indexintIndex of the skidmark set to clean.

// Clean skidmark set 0 only
RCCP.CleanSkidmarks(0);

Events Reference

RCCP_Events is a static class containing C# events you can subscribe to. These events fire automatically when the corresponding actions occur in RCCP. Use them to react to vehicle spawns, collisions, camera changes, and more.

How to Subscribe and Unsubscribe

Always subscribe in OnEnable() and unsubscribe in OnDisable() to prevent memory leaks and errors from destroyed objects.


using UnityEngine;

public class MyGameManager : MonoBehaviour {

    void OnEnable() {
        // Subscribe to events
        RCCP_Events.OnRCCPSpawned += OnVehicleSpawned;
        RCCP_Events.OnRCCPCollision += OnVehicleCollision;
        RCCP_Events.OnVehicleChanged += OnPlayerVehicleChanged;
    }

    void OnDisable() {
        // Unsubscribe from events
        RCCP_Events.OnRCCPSpawned -= OnVehicleSpawned;
        RCCP_Events.OnRCCPCollision -= OnVehicleCollision;
        RCCP_Events.OnVehicleChanged -= OnPlayerVehicleChanged;
    }

    void OnVehicleSpawned(RCCP_CarController vehicle) {
        Debug.Log("Vehicle spawned: " + vehicle.name);
    }

    void OnVehicleCollision(RCCP_CarController vehicle, Collision collision) {
        Debug.Log(vehicle.name + " collided with " + collision.gameObject.name);
    }

    void OnPlayerVehicleChanged() {
        Debug.Log("Player switched to a different vehicle.");
    }
}

Events Table

EventDelegate SignatureWhen It Fires
OnRCCPSpawnedonRCCPSpawned(RCCP_CarController rccp)A player vehicle spawns or becomes enabled.
OnRCCPDestroyedonRCCPDestroyed(RCCP_CarController rccp)A player vehicle is destroyed or disabled.
OnRCCPAISpawnedonRCCPAISpawned(RCCP_CarController rccp)A vehicle with an AI component spawns or becomes enabled.
OnRCCPAIDestroyedonRCCPAIDestroyed(RCCP_CarController rccp)A vehicle with an AI component is destroyed or disabled.
OnRCCPCollisiononRCCPCollision(RCCP_CarController rccp, Collision collision)Any RCCP vehicle collides with another object.
OnRCCPCameraSpawnedonRCCPCameraSpawned(RCCP_Camera cam)The RCCP camera is spawned or initialized.
OnRCCPUISpawnedonRCCPUISpawned(RCCP_UIManager UI)The RCCP UI canvas is spawned or initialized.
OnRCCPUIDestroyedonRCCPUIDestroyed(RCCP_UIManager UI)The RCCP UI canvas is destroyed or disabled.
OnRCCPUIInformeronRCCPUIInformer(string text)A UI informer message should be displayed to the player.
OnBehaviorChangedonBehaviorChanged()The global behavior preset is changed via RCCP.SetBehavior().
OnVehicleChangedonVehicleChanged()The registered player vehicle changes (no vehicle reference).
OnVehicleChangedToVehicleonVehicleChangedToVehicle(RCCP_CarController carController)The registered player vehicle changes (includes the new vehicle reference).

Event Details

OnRCCPSpawned / OnRCCPDestroyed -- These fire for player vehicles (vehicles without an AI component). If a vehicle has an AI component attached, OnRCCPAISpawned and OnRCCPAIDestroyed fire instead.

OnRCCPCollision -- Provides both the RCCP vehicle and the Unity Collision object, so you can inspect contact points, impulse, and the other collider.

OnVehicleChanged vs OnVehicleChangedToVehicle -- Both fire when the player vehicle changes. OnVehicleChanged takes no parameters (useful when you just need to refresh UI). OnVehicleChangedToVehicle passes the new vehicle reference (useful when you need to read data from the new vehicle).

OnRCCPUIInformer -- Subscribe to this event to display informational messages in your own custom UI. RCCP fires this when it wants to show a message to the player (e.g., "Engine Started").


RCCP_CarController Key Properties

Once you have a reference to an RCCP_CarController, you can read these public fields and properties to build HUD displays, telemetry systems, or game logic.

Vehicle State

PropertyTypeDescription
speedfloatCurrent speed in km/h. Signed: positive = forward, negative = reverse.
absoluteSpeedfloatSame as speed but always positive (unsigned). Use this for speedometer displays.
maximumSpeedfloatCalculated maximum speed based on engine RPM, gear ratios, differential ratio, and wheel diameter.
directionint1 = forward, -1 = reverse.
engineRunningbooltrue if the engine is currently running.
engineStartingbooltrue during the engine start animation/delay.
IsGroundedbooltrue if at least one wheel is touching the ground.

Engine and Drivetrain

PropertyTypeDescription
engineRPMfloatCurrent engine RPM.
minEngineRPMfloatIdle RPM (engine will not drop below this).
maxEngineRPMfloatRedline RPM (engine will not exceed this).
currentGearintCurrent gear index. 0 = first gear.
currentGearRatiofloatGear ratio of the current gear.
differentialRatiofloatDifferential ratio.
shiftingNowbooltrue while the gearbox is in the middle of a gear change.
NGearNowbooltrue if the gearbox is currently in Neutral.
reversingNowbooltrue if the vehicle is currently in a reverse gear.
producedEngineTorquefloatTorque currently produced by the engine.
producedGearboxTorquefloatTorque output from the gearbox.
producedDifferentialTorquefloatTorque output from the differential.
steerAnglefloatCurrent steering angle in degrees.

Vehicle-Side Inputs (Read from Components)

These values reflect what the vehicle's subsystems are actually applying. Use these for accurate HUD gauges.

PropertyTypeRangeDescription
throttleInput_Vfloat0 to 1Throttle being applied to the engine.
brakeInput_Vfloat0 to 1Brake force being applied.
steerInput_Vfloat-1 to 1Steering input (-1 = full left, 1 = full right).
handbrakeInput_Vfloat0 to 1Handbrake force being applied.
clutchInput_Vfloat0 to 1Clutch engagement.
nosInput_Vfloat0 to 1Nitrous oxide input.
fuelInput_Vfloat0 to 1Fuel flow to the engine.
gearInput_Vfloat--Gear shift input value.

Player-Side Inputs (Raw from Input Manager)

These values reflect what the player is pressing before any processing by vehicle components.

PropertyTypeRangeDescription
throttleInput_Pfloat0 to 1Raw throttle input from the player.
brakeInput_Pfloat0 to 1Raw brake input from the player.
steerInput_Pfloat-1 to 1Raw steering input from the player.
handbrakeInput_Pfloat0 to 1Raw handbrake input from the player.
clutchInput_Pfloat0 to 1Raw clutch input from the player.
nosInput_Pfloat0 to 1Raw nitrous input from the player.

Control Flags

PropertyTypeDescription
canControlboolWhen true, the vehicle accepts player input. When false, inputs are zeroed and brakes apply.
externalControlboolWhen true, the vehicle is driven externally (AI, network, replay). Player input is ignored.
ineffectiveBehaviorboolWhen true, global behavior presets are not applied to this vehicle.

Lights

PropertyTypeDescription
lowBeamLightsboolLow beam headlights on/off.
highBeamLightsboolHigh beam headlights on/off.
indicatorsLeftLightsboolLeft indicator on/off.
indicatorsRightLightsboolRight indicator on/off.
indicatorsAllLightsboolHazard lights (all indicators) on/off.

Other

PropertyTypeDescription
ConnectedTrailerRCCP_TrailerControllerThe currently attached trailer, or null if no trailer is connected.
wheelRPM2SpeedfloatVehicle speed calculated from wheel RPM.
tractionWheelRPM2EngineRPMfloatEngine RPM calculated from traction wheel RPM.

Practical Code Examples

Example 1: Spawning a Vehicle and Registering as Player

This example spawns a vehicle from a prefab, registers it as the player vehicle, starts the engine, and enables control.


using UnityEngine;

public class VehicleSpawner : MonoBehaviour {

    // Assign your vehicle prefab in the Inspector
    public RCCP_CarController vehiclePrefab;
    public Transform spawnPoint;

    void Start() {

        // Spawn the vehicle at the spawn point
        RCCP_CarController car = RCCP.SpawnRCC(
            vehiclePrefab,
            spawnPoint.position,
            spawnPoint.rotation,
            true,   // register as player vehicle
            true,   // enable player control
            true    // start engine
        );

        Debug.Log("Spawned vehicle: " + car.name);

    }
}

Example 2: Switching Between Multiple Vehicles

This example lets the player cycle through a list of pre-spawned vehicles by pressing a key.


using UnityEngine;

public class VehicleSwitcher : MonoBehaviour {

    // Assign your pre-spawned vehicles in the Inspector
    public RCCP_CarController[] vehicles;
    private int currentIndex = 0;

    void Start() {

        // Register the first vehicle as the player vehicle
        if (vehicles.Length > 0) {
            RCCP.RegisterPlayerVehicle(vehicles[0], true, true);
        }

    }

    void Update() {

        // Press V to switch to the next vehicle
        if (Input.GetKeyDown(KeyCode.V) && vehicles.Length > 1) {

            // Disable control on the current vehicle
            RCCP.SetControl(vehicles[currentIndex], false);
            RCCP.SetEngine(vehicles[currentIndex], false);

            // Move to the next vehicle
            currentIndex = (currentIndex + 1) % vehicles.Length;

            // Register the new vehicle as the player vehicle
            RCCP.RegisterPlayerVehicle(vehicles[currentIndex], true, true);

            Debug.Log("Switched to: " + vehicles[currentIndex].name);

        }

    }
}

Example 3: Reading Vehicle Speed and RPM for a Custom HUD

This example reads real-time data from the player vehicle and displays it using Unity UI.


using UnityEngine;
using UnityEngine.UI;

public class CustomHUD : MonoBehaviour {

    public Text speedText;
    public Text rpmText;
    public Text gearText;
    public Slider rpmBar;

    void Update() {

        // Get the active player vehicle from the scene manager
        RCCP_CarController car = RCCP_SceneManager.Instance.activePlayerVehicle;

        // If no player vehicle is registered, hide the HUD
        if (car == null) {
            speedText.text = "---";
            rpmText.text = "---";
            gearText.text = "-";
            return;
        }

        // Display speed (always positive for the speedometer)
        speedText.text = car.absoluteSpeed.ToString("F0") + " km/h";

        // Display engine RPM
        rpmText.text = car.engineRPM.ToString("F0") + " RPM";

        // Display current gear (add 1 for human-readable numbering)
        if (car.NGearNow)
            gearText.text = "N";
        else if (car.reversingNow)
            gearText.text = "R";
        else
            gearText.text = (car.currentGear + 1).ToString();

        // RPM bar normalized between min and max RPM
        if (rpmBar != null) {
            float normalizedRPM = Mathf.InverseLerp(car.minEngineRPM, car.maxEngineRPM, car.engineRPM);
            rpmBar.value = normalizedRPM;
        }

    }
}

Example 4: Listening to Events

This example demonstrates subscribing to multiple RCCP events to build a game manager.


using UnityEngine;

public class RaceManager : MonoBehaviour {

    void OnEnable() {
        RCCP_Events.OnRCCPSpawned += HandleVehicleSpawned;
        RCCP_Events.OnRCCPCollision += HandleCollision;
        RCCP_Events.OnBehaviorChanged += HandleBehaviorChanged;
        RCCP_Events.OnVehicleChangedToVehicle += HandleVehicleSwitch;
    }

    void OnDisable() {
        RCCP_Events.OnRCCPSpawned -= HandleVehicleSpawned;
        RCCP_Events.OnRCCPCollision -= HandleCollision;
        RCCP_Events.OnBehaviorChanged -= HandleBehaviorChanged;
        RCCP_Events.OnVehicleChangedToVehicle -= HandleVehicleSwitch;
    }

    void HandleVehicleSpawned(RCCP_CarController vehicle) {
        Debug.Log("New vehicle entered the race: " + vehicle.name);
    }

    void HandleCollision(RCCP_CarController vehicle, Collision collision) {
        // Apply score penalty for wall hits
        if (collision.gameObject.CompareTag("Wall")) {
            Debug.Log(vehicle.name + " hit a wall!");
        }
    }

    void HandleBehaviorChanged() {
        Debug.Log("Driving mode changed.");
    }

    void HandleVehicleSwitch(RCCP_CarController newVehicle) {
        Debug.Log("Player now driving: " + newVehicle.name);
    }
}

Quick Reference Table

A summary of every method in the RCCP class for quick lookup.

MethodParametersReturnsDescription
SpawnRCCprefab, position, rotation, register, control, engineRCCP_CarControllerSpawn a vehicle prefab.
RegisterPlayerVehiclevehiclevoidRegister as player vehicle.
RegisterPlayerVehiclevehicle, isControllablevoidRegister with control state.
RegisterPlayerVehiclevehicle, isControllable, engineStatevoidRegister with control and engine state.
DeRegisterPlayerVehicle(none)voidRemove player vehicle registration.
SetControlvehicle, isControllablevoidEnable/disable player input.
SetExternalControlvehicle, isExternalvoidMark as AI/network controlled.
SetEnginevehicle, engineStatevoidStart or stop the engine.
SetAutomaticGearvehicle, state (bool)voidToggle automatic/manual transmission.
SetAutomaticGearvehicle, transmissionTypevoidSet specific transmission type.
ChangeCamera(none)voidCycle camera modes.
Transportposition, rotationvoidTeleport the player vehicle.
Transportvehicle, position, rotationvoidTeleport a specific vehicle.
Transportvehicle, position, rotation, resetVelocityvoidTeleport with optional velocity reset.
SetBehaviorbehaviorIndex (int)voidApply behavior preset by index.
SetBehaviorbehaviorName (string)voidApply behavior preset by name.
GetBehaviorIndexByNamebehaviorNameintGet preset index (-1 if not found).
GetBehaviorByNamebehaviorNameBehaviorTypeGet preset object (null if not found).
SetMobileControllermobileControllervoidChange mobile input method.
StartStopRecordvehiclevoidToggle recording.
StartStopReplayvehiclevoidToggle replay of last recording.
StartStopReplayvehicle, recordedClipvoidToggle replay of specific clip.
StopRecordReplayvehiclevoidStop all recording/replay.
RepaircarControllervoidRepair a specific vehicle.
Repair(none)voidRepair the player vehicle.
CleanSkidmarks(none)voidRemove all skidmarks.
CleanSkidmarksindex (int)voidRemove skidmarks by index.

Support: bonecrackergames@gmail.com | www.bonecrackergames.com

Need help? See Troubleshooting