How to use the Kuti Input
This short guide should get you on track with your Kuti game development endeavors.
You will need two things for this: Unity and the Kuti Input package. Here are the 3 Steps to get the Input package and use it.
1: Download the Kuti Input Package (here).
2: Import the KutiInputPackage into your Unity Project.
This will add the KUBA folder to your Project. It contains the scripts needed for the Input mapper. There is no need to do anything with it.
3: Add the AndroidInputAdapter prefab to your first loaded Scene
The AndroidInputAdapter prefab can be found under: Assets/KUBA/KutiDevKit/Content/Prefabs/AndroidInputAdapter
Drag and drop the Prefab into your first Scene that is loaded on startup and save the scene. The Input Adapter is now ready.
4: Use the KutiInput class
Below is a code snippet showing how to use the KutiInput class. The KutiInput is used in the same way any Unity Input would be used.
Buttons are mapped with the EKutiButton class. For example, if you want to check the middle button of player 1, you want to use EKutiButton.P1_MID for the Left Button its EKutiButton.P1_LEFT etc. as parameter.
When testing your game in Unity or any device other then Android the Kuti Input will use the following buttons:
A: Player 1 Left
W: Player 1 Middle
D: Player 1 Right
H: Player 2 left
U: Player 2 middle
K: Player 2 Right
KEEP IN MIND: The buttons are in respect to the players’ orientations. Player 2 sees the screen “upside down”, therefore player 1 left and player 2 left don’t point in the same direction in the game. Here is a diagram.
There are 3 methods you can use. They function like their native Unity counterparts.
- GetKutiButtonDown(EKutiButton button)
- GetKutiButton(EKutiButton button)
- GetKutiButtonUp(EKutiButton button)
There is another set of methods 3 that can be used for convenience:
- GetAnyButtonDownPlayer1() // checks if player 1 has pressed any button
- GetAnyButtonDownPlayer2() // checks if player 2 has pressed any button
- GetAnyButtonDown() // checks if any player has pressed any button