Input Handling [New]
Last updated
Last updated
In the “RhythmGameStarter” prefab, there’s two-component
TouchInputHandler
: this enables touch input, to test with touch input, please install the device simulator from the package manager
KeyboardInputHandler
: you can specify different keys for each track, and also the direction key for the “swipe” note, which you can trigger by pressing the corresponding track and direction key at the same time
A new type of input script was added in 0.7.0, which allows you to link a UI button to a track
On version 0.9.0! There is finally Input System support
For Input System Support, Please make sure your Input System's version is higher than 1.1
First, make sure you have the right Input System version for RGS in the UPM!
If you were not able to find InputSystem 1.1+, you need to open up the "manifest.json" and edit the version directly, currently, version 1.1 is still in preview, so you can enter the version "1.1.0-pre.5" there.
Next, to enable the Input System, first head to the Player Settings, in the others tab, look for Active Input Handling, next, either set to "Both" or Only the new "Input System Package".
After that, Unity will prompt you to restart.
With Input System enabled, you can look into the Input System-specific demo.
You will see that the default Input script has been removed.
While they have been replaced by the Input System Handler + Input System Touch Handler. Alongside the Player Input component.
The default Input actions asset is located at "QuickStart/Basic/InputSystem/Keyboard Controls", you can duplicate it, then assign it to the PlayerInput component of your RhyhtmCore prefab, next click on the "Update Input Reference" of the Input System Handler to refresh the input reference.
For each track control, the naming starts with the "Track" prefix, to add more track control, simply duplicated from an existing control, or add them like "Track 5", "Track 6" etc.