# Conjure Arcade Controller Package Unity Input System support for Conjure Arcade Controllers. ## Features - Custom Input Device implementation for Conjure Arcade Controllers - Arcade stick support with directional buttons (up, down, left, right) - 8 button support (Home, Start, 1-3, A-C) - Multi-controller support with controller indexing - Integration with Unity's Input System - Input Action Asset extensions for easy controller assignment ## Requirements - Unity 2021.3 or later - Unity Input System package (1.4.4 or later) ## Installation ### Via Package Manager (Git URL) 1. Open the Package Manager in Unity 2. Click the "+" button and select "Add package from git URL" 3. Enter the repository URL ### Via Package Manager (Local) 1. Download or clone this repository 2. Open the Package Manager in Unity 3. Click the "+" button and select "Add package from disk" 4. Select the `package.json` file from the downloaded folder ## Quick Start ### Basic Usage ```csharp using ConjureOS.Input; using UnityEngine; public class PlayerController : MonoBehaviour { void Update() { var controller = ConjureArcadeController.current; if (controller == null) return; // Read stick input Vector2 stickInput = controller.stick.ReadValue(); // Check button presses if (controller.buttonA.wasPressedThisFrame) { // Handle A button press } if (controller.start.wasPressedThisFrame) { // Handle start button press } } } ``` ### Using Input Actions 1. Create an Input Action Asset in your project 2. Add actions and bind them to Conjure controller inputs: - Stick: `/stick` - Buttons: `/buttonA`, `/start`, etc. ```csharp using ConjureOS.Input; using UnityEngine; using UnityEngine.InputSystem; public class InputActionExample : MonoBehaviour { [SerializeField] private InputActionAsset inputActions; void Start() { // Assign controller 0 to this input action asset inputActions.AssignConjureController(0); inputActions.Enable(); } } ``` ### Multi-Controller Support ```csharp // Check how many controllers are connected int controllerCount = ConjureArcadeController.ControllerCount; // Get specific controller by index ConjureArcadeController player1 = ConjureArcadeController.GetForIndex(0); ConjureArcadeController player2 = ConjureArcadeController.GetForIndex(1); // Check if controller exists for index if (ConjureArcadeController.ExistForIndex(0)) { // Controller 0 is available } ``` ## API Reference ### ConjureArcadeController Main controller class that provides access to all inputs. **Properties:** - `stick` - ConjureArcadeStickControl for joystick input - `home`, `start` - ButtonControl for system buttons - `button1`, `button2`, `button3` - ButtonControl for numbered buttons - `buttonA`, `buttonB`, `buttonC` - ButtonControl for lettered buttons - `ControllerIndex` - The index of this controller instance **Static Properties:** - `current` - Currently active controller - `allControllers` - Array of all connected controllers - `ControllerCount` - Number of connected controllers **Static Methods:** - `ExistForIndex(int)` - Check if controller exists for index - `GetForIndex(int)` - Get controller by index **Events:** - `OnControllerAdded` - Fired when a controller is connected - `OnControllerRemoved` - Fired when a controller is disconnected ### ConjureArcadeStickControl Custom stick control that provides both Vector2 input and directional buttons. **Properties:** - `up`, `down`, `left`, `right` - ButtonControl for directional input - Standard Vector2Control properties for analog input ### InputActionAssetExtension Extension methods for InputActionAsset to simplify controller assignment. **Methods:** - `AssignConjureController(int, bool)` - Assign specific controller to asset - `CanAssignConjureController(int)` - Check if controller can be assigned - `GetConjureControllerIndex()` - Get assigned controller index - `GetConjureControllerIndexes()` - Get all assigned controller indexes ## Input Bindings When setting up Input Actions, use these binding paths: - **Stick (Vector2)**: `/stick` - **Stick Directions**: - `/stick/up` - `/stick/down` - `/stick/left` - `/stick/right` - **Buttons**: - `/home` - `/start` - `/button1` - `/button2` - `/button3` - `/buttonA` - `/buttonB` - `/buttonC` ## Hardware Information The controller is detected as: - **Interface**: HID - **Product**: "Generic USB Joystick " (note the extra spaces)