Damit ein Kuti mit Deinem Unity-Spiel zusammen funktioniert, musst Du in Dein Unity-Projekt unser „Kuti Input Package“ importieren. Es sagt Unity, wie die Tasten angesteuert werden.
1: Hier kannst du unsere Datei „KutiInputPackage“ herunterladen.
2: Importiere diese Datei in Dein Unity-Projekt.
Dies fügt Deinem Unity-Projekt einen Ordner „KUBA“ zu. In ihm liegt ein Script, das die Tasten des Kutis den Keyboard-Tasten im Unity-Projekt zuordnet.
![](https://kuti-spiele.com/wp-content/uploads/2021/05/Import.png)
3: Füge den AndroidInputAdapter prefab in Deine erste geladene Szene ein
Den AndroidInputAdapter prefab findest Du hier: Assets/KUBA/KutiDevKit/Content/Prefabs/AndroidInputAdapter
Ziehe den AndroidInputAdapter prefab in die erste Szene, die beim Start geladen wird und sichere die Szene dann. Der Input Adapter ist jetzt fertig.
4: Verwende die KutiInput class
Dieser Codeschnipsel zeigt, wie die KutiInput class benutzt wird. KutiInput wird genauso verwendet wie jeder andere Unity Input.
![](https://kuti-spiele.com/wp-content/uploads/2021/05/Code.png)
Buttons are mapped with the EKutiButton class. For example, if you want to check the middle button of player 1, you want to useEKutiButton.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.
![](https://kuti-spiele.com/wp-content/uploads/2021/05/Kuti_KeyMapping.png)
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