Mobile Input
Last updated
Last updated
To easily configure mobile inputs, make sure InputSystem package is installed
Locate the mobile UI controls prefab in "CustomVehicleController/Demo/Prefabs/UI".
Drag and drop it into the canvas in the scene.
Delete the "YouCanDeleteThis" game object. It has buttons that make calls to the DemoManager to swap presets and change drivetrain as well as set the "LeftStick" and "SteerButtons" active/inactive.
If you want to change the image of the buttons, locate the needed game object and change the sprite.
Make sure the image you want to assign is imported as a Sprite.
First of all, add a component that extends IVehicleControllerInputProvider and uses the new InputSystem to the the same gameobject where the CustomVehicleController is attached. You can use the "VehicleInputProviderDemo" component that comes with this package, or make your own script.
Then, locate the input action asset and open it. If you are using the "VehicleInputProviderDemo", open the input actions asset the asset at "CustomVehicleController/VehicleController/Scripts/Input". If your custom script doesn't use this asset, find you own one.
Find the action that you are interested in and remember path.
Add new Image to the Canvas.
Add the "On-Screen Button" or "On-Screen Stick" component.
In the "Control Path" select the path for the action.