How To Upgrade Tiny Car Controller’s Default Input With InControl

Jordan Cassady
2 min readMay 3, 2021

--

David Jalbert’s Tiny Car Controller uses Unity’s Standalone Input Module by default, enabling developers to get their projects up and running quickly with basic keyboard and controller support. However, ensuring compatibility with a wide variety of controllers can quickly become cumbersome. Gallant Games’ InControl has support for just about any controller you could want, including XInput if you’re interested in bypassing Unity’s input system entirely.

In my game Disaster Drive, boost can be activated for a temporary speed increase. By default, the player uses the shift key when playing with a keyboard, and the right bumper button when playing with a controller.

In order to map button presses to actions performed by the vehicle (e.g. boost), we need to setup instances of the PlayerAction class in our own subclass, which I’ve named VehicleActions.

In this example, a single action — boost — is mapped to the appropriate buttons for both keyboard and controller input buttons. Note that the Y button has also been assigned to boost using InControl’s standardized Action4 assignment.

In the class constructor VehicleActions(), instances of our actions are instantiated with CreatePlayerAction().

CreateDefaultBindings() links the actual button presses to the VehicleActions with AddDefaultBinding(). Finishing up, this method can be called in a player controller script such as the VehicleController example below.

For a complete example, see InControl’s documentation: Binding Actions To Controls.

Would you like to give Disaster Drive a go? Join the Steam Playtest by clicking the “Request Access” button:

https://store.steampowered.com/app/1551720/Disaster_Drive/

--

--