Controller Support Overview
What is RetroDev.Controller?
RetroDev.Controller is a unified game controller input system for Unity. It provides pre-mapped input configurations for PlayStation, Xbox, and generic controllers, making it incredibly easy to add professional controller support to your game.
Get RetroDev.Controller here:
The Problem It Solves
Supporting multiple controller types means dealing with different button layouts and input names:
Before RetroDev.Controller:
// Different input names for each controller typeif (Input.GetKey(KeyCode.JoystickButton0)) { // What button is this?? // PlayStation Circle? Xbox A? Generic Button1?}
// You need to manually map each controller's buttons// And handle platform-specific differencesWith RetroDev.Controller:
// Clear, semantic button namesif (Input.GetKey(PlayStation.Circle)) { Debug.Log("Circle pressed on PlayStation");}
if (Input.GetKey(Xbox.A)) { Debug.Log("A pressed on Xbox");}Key Features
Pre-Mapped Controllers
Built-in support for PlayStation, Xbox, and generic controllers with semantic button names.
Auto-Detection
Detect which controller is connected and initialize the appropriate button mappings automatically.
Readable Code
Use PlayStation.Cross, Xbox.A, or Generic.ActionSouth instead of cryptic JoystickButton0.
Cross-Platform
Works consistently across Windows, Mac, Linux, and consoles.
Supported Controllers
PlayStation Controllers
All PlayStation button names:
PlayStation.Cross,Circle,Square,TrianglePlayStation.L1,L2,R1,R2PlayStation.DPadUp,DPadDown,DPadLeft,DPadRightPlayStation.Options,Share,PS,Touchpad
Xbox Controllers
All Xbox button names:
Xbox.A,B,X,YXbox.LB,LT,RB,RTXbox.DPadUp,DPadDown,DPadLeft,DPadRightXbox.Menu,View,Xbox
Generic Controllers
Universal button names for any controller:
Generic.ActionSouth,ActionEast,ActionWest,ActionNorthGeneric.ShoulderLeft,TriggerLeft,ShoulderRight,TriggerRightGeneric.Start,Select
How It Works
1. Detection
bool controllerConnected = Controller.DetectConnectedController();if (controllerConnected) { Debug.Log("Controller detected and mapped!");}2. Get Button Names
// Get the Unity input name for a buttonstring crossButton = Controller.GetButtonName("Cross");// Returns the actual Input name Unity uses3. Use Pre-Mapped Inputs
// Direct button checks with semantic namesif (Input.GetKey(PlayStation.Circle)) { Jump();}
if (Input.GetKey(Xbox.A)) { Jump();}Common Use Cases
Multi-Platform Support:
void HandleJumpInput() { if (Input.GetKeyDown(PlayStation.Cross) || Input.GetKeyDown(Xbox.A) || Input.GetKeyDown(Generic.ActionSouth)) { player.Jump(); }}Dynamic Button Prompts:
void UpdateButtonPrompts() { if (Controller.DetectConnectedController()) { string jumpButton = Controller.GetButtonName("Cross"); promptText.text = $"Press {jumpButton} to jump"; }}Controller-Specific Features:
void CheckControllerType() { // PlayStation-specific features if (Input.GetKey(PlayStation.Touchpad)) { OpenMap(); }
// Xbox-specific features if (Input.GetKey(Xbox.Menu)) { OpenMenu(); }}When to Use RetroDev.Controller
Perfect for:
- Games with gamepad support
- Cross-platform controller compatibility
- Console game ports
- Couch co-op games
- Any game better with a controller
You might not need it if:
- Your game is keyboard/mouse only
- You’re using Unity’s new Input System package
- You only support one specific controller type
Platform Differences
Combining with Keyboard
RetroDev.Controller works alongside keyboard input:
void HandleInput() { // Keyboard if (Input.GetKey(KeyCode.Space)) { Jump(); }
// Controller if (Input.GetKey(PlayStation.Cross) || Input.GetKey(Xbox.A)) { Jump(); }}Generic vs Specific
Use Generic mappings when you want controller-agnostic code:
// Works with any controller typeif (Input.GetKey(Generic.ActionSouth)) { // This is Cross on PlayStation, A on Xbox, Button0 on others ConfirmAction();}Use specific mappings when you need brand-specific features or prompts.
Getting Started
Ready to add professional controller support? Check out the Quick Start guide for complete setup instructions and examples.