Vehicle Controller Input Provider
Handling user input.
Last updated
Handling user input.
Last updated
The CustomVehicleController comes with the VehicleControllerInputProvider script for handling user input. It uses old Unity's input system and doesn't require anything to work. You can simply assign this component to the GameObject with the CustomVehicleController component.
A CustomVehicleController component requires a MonoBehaviour that implements the IVehicleControllerInputProvider interface.
Create new script
Inherit from IVehicleControllerInputProvider
Implement the interface
Assign a new script to the game object with the CustomVehicleController component.
In the Awake method, the Custom Vehicle Controller searches for the component that implements the IVehicleControllerInputProvider interface. If no such component is found, then:
If the Input System is installed, the "VehicleInputProviderDemo" component, which uses the Input System, will be added.
If the Input System is not installed, the "VehicleControllerInputProvider" component, which uses the Input Manager, will be added.
If more than 1 components are found, the first one will be used.
If you have Input System package installed, just add a "Vehicle Input Provider Demo" component. Otherwise, following the first step from the Input System Example, install the package and then add the component.
If you want to implement your own version of input handling script, see the example using the Input System.