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)
- Open the Package Manager in Unity
- Click the "+" button and select "Add package from git URL"
- Enter the repository URL
Via Package Manager (Local)
- Download or clone this repository
- Open the Package Manager in Unity
- Click the "+" button and select "Add package from disk"
- Select the
package.jsonfile from the downloaded folder
Quick Start
Basic Usage
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
- Create an Input Action Asset in your project
- Add actions and bind them to Conjure controller inputs:
- Stick:
<ConjureArcadeController>/stick - Buttons:
<ConjureArcadeController>/buttonA,<ConjureArcadeController>/start, etc.
- Stick:
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
// 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 inputhome,start- ButtonControl for system buttonsbutton1,button2,button3- ButtonControl for numbered buttonsbuttonA,buttonB,buttonC- ButtonControl for lettered buttonsControllerIndex- The index of this controller instance
Static Properties:
current- Currently active controllerallControllers- Array of all connected controllersControllerCount- Number of connected controllers
Static Methods:
ExistForIndex(int)- Check if controller exists for indexGetForIndex(int)- Get controller by index
Events:
OnControllerAdded- Fired when a controller is connectedOnControllerRemoved- 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 assetCanAssignConjureController(int)- Check if controller can be assignedGetConjureControllerIndex()- Get assigned controller indexGetConjureControllerIndexes()- Get all assigned controller indexes
Input Bindings
When setting up Input Actions, use these binding paths:
- Stick (Vector2):
<ConjureArcadeController>/stick - Stick Directions:
<ConjureArcadeController>/stick/up<ConjureArcadeController>/stick/down<ConjureArcadeController>/stick/left<ConjureArcadeController>/stick/right
- Buttons:
<ConjureArcadeController>/home<ConjureArcadeController>/start<ConjureArcadeController>/button1<ConjureArcadeController>/button2<ConjureArcadeController>/button3<ConjureArcadeController>/buttonA<ConjureArcadeController>/buttonB<ConjureArcadeController>/buttonC
Hardware Information
The controller is detected as:
- Interface: HID
- Product: "Generic USB Joystick " (note the extra spaces)
Description
Languages
C#
100%