Gearbox block #

VP Vehicle Controller gearbox

(Documentation Work In Progress)

Data Bus parameters #

Data Bus Value Description Notes
InputData.ManualGear Manual gear lever position -1 (reverse), 0 (neutral), 1, 2, 3, ...
InputData.AutomaticGear Automatic transmission mode 1 0, 1, 2, 3, 4, 5 = M, P, R, N, D, L
InputData.GearShift Incremental gear shifting value 2 Add +1 for gear up or -1 for gear down
VehicleData.GearboxGear Currently engaged gear Negative = reverse, 0 = Neutral or Park, Positive = forward.
VehicleData.GearboxMode Actual transmission mode 0, 1, 2, 3, 4, 5 = M, P, R, N, D, L
VehicleData.GearboxShifting Is the gearbox in the middle of a gear shift operation? 0 = no, 1 = yes
SettingsData.AutoShiftOverride Auto-shift override setting 3 0 = no override, 1 = force auto shift, 2 = force manual shift

See Data Bus Reference for more information.

1 Automatic transmission modes:
  • M (0): Manual: do not automatically engage gears. Use manual gear shifting.
  • P (1): Park
  • R (2): Reverse. Gear shifting is supported for more than one reverse gears.
  • N (3): Neutral
  • D (4): Drive: automatically engage forward gears. Gear shifting is supported for forward gears.
  • L (5): Low: first gear only.

2 GearShift value is reset to 0 when the vehicle has acknowledged and processed the input. Successive gear shift commands can be grouped by adding/subtracting +-1 to this bus value.

3 AutoShiftOverride: See notes below.

The AutoShiftOverride value #

The behavior of AutoShiftOverride depends on the vehicle's transmission type:

AutoShiftOverride is intended to temporary overrides in specific situations. For example, it's used for preventing gear shifting during replays, as the replay data already includes the currently engaged gear.

AutoShiftOverride is not a reliable way of implementing an auto-shift / manual-shift selector in the vehicle because the value might be overwritten by other components. See below.

Auto-shift / manual-shift selection #

Determining the transmission type

If you want to configure the shift mode externally to the vehicle (i.e. via UI or hotkey) then you should probably use a Manual transmission and modify the auto-shift flag. The Automatic transmission is intended to allow users to select among Drive [D] (automatic) or Manual [M] themselves using the vehicle input.

The behavior of the automated gear shifting is different between Automatic and Manual transmissions:

Example: Add-on component that modifies the Gearbox settings in runtime in any transmission type.

using UnityEngine;
using VehiclePhysics;

public class GearShiftModeSelector : VehicleBehaviour
    public enum GearShiftMode { Manual, Automatic }
    public GearShiftMode mode = GearShiftMode.Manual;

    Gearbox.Settings m_gearboxSettings;

    public override void OnEnableVehicle ()
        // Retrieve a reference to the gearbox settings
        var gearbox = vehicle.GetInternalObject(typeof(Gearbox)) as Gearbox;
        if (gearbox == null)
            // This vehicle doesn't have a gearbox. Self-disable this add-on.
            enabled = false;

        m_gearboxSettings = gearbox.settings;

    public override void FixedUpdateVehicle ()
        if (m_gearboxSettings.type == Gearbox.Type.Automatic)
            // Automatic Transmission. Select the proper mode.
            if (mode == GearShiftMode.Automatic)
                // Force select mode D (4) unless current mode is R (2)
                if (, InputData.AutomaticGear) != 2)
          , InputData.AutomaticGear, 4);
                // Force select mode M (0)
      , InputData.AutomaticGear, 0);
            // Manual gearbox. Just match the auto-shift mode.
            m_gearboxSettings.autoShift = mode == GearShiftMode.Automatic;