This article describes the cross-platform input toolkit crossplatforminput, which mainly includes the prefabs and Scripts two folders:
Because the scripts in this package are closely related, they are all designed to implement specific functions and are not very independent and reusable, so we only introduce the individual presets.
Cartiltcontrols Presets:
Cross-platform input control for racing games. You can choose between two input modes:
One, vertical axis input value is controlled by a pair of buttons, horizontal axis input value by the device Gravity induction control (target platform for the PC using mouse position simulation, the same below);
Two, the input values in two directions are controlled by touch screen swipe (mobile device) or mouse drag (PC).
Dualtouchcontrols Presets:
Demonstrates how touchpad scripts are used in multi-touch scenarios to avoid collisions by mapping sliding or dragging data from different regions to different virtual axes.
Mobileaircraftcontrols Presets:
Cross-platform input control for aircraft. This paper mainly demonstrates the use of the Buttonhandler script to automatically map the press and lift of a touch or mouse pointer to the state change of a specific virtual axis. The gravity-sensing data is also mapped to horizontal and vertical input values.
Mobilesinglestickcontrol Presets:
Mainly demonstrates the use of joystick scripts, by sliding or dragging the control input, and the difference between the touchpad is to use the distance from the starting point rather than the previous frame position as the input value.
Mobiletiltcontrolrig Presets:
Without UI elements, the values of their mapped axes can be obtained in code through Crossplatforminputmanager, with input from gravity-sensing data (mobile platform) or mouse position (PC).
Unity Standard Assets Profile Crossplatforminput