Skip to content

Archived on 2026-10-24. This is a historical implementation note, not current setup instructions or an active task list. Original claims, code examples, file paths, and completion statements have not all been revalidated. Use the current documentation and issue register for maintenance decisions.

Joystick Detection System - Quick Start Guide

What You Need to Do

This guide will help you quickly set up the joystick detection system in your game.

Files Created

  1. InputManager.cs (Modified) - Added joystick refresh and controller detection
  2. JoystickDetectionView.cs - Main UI component for controller detection
  3. ControllerItem.cs - Individual controller item in the list
  4. JoystickDetectionPage.cs - Page integration component
  5. JoystickDetectionSystem.md - Complete documentation

Setup Steps (5-10 minutes)

Step 1: Create the UI in Unity

  1. In your main menu or settings scene, create a new UI panel
  2. Add a JoystickDetectionPage component to it (it will auto-add CanvasGroup)
  3. Create the following child objects under the panel:
JoystickDetectionPage
├── JoystickDetectionView (empty GameObject)
│   ├── StatusText (TMP_Text) - "1 controller detected"
│   ├── NoControllerText (TMP_Text) - "No controllers detected"
│   ├── ControllerListContainer (Vertical Layout Group, Content Size Fitter)
│   ├── RefreshButton (Button) - "Refresh"
│   ├── ConfirmButton (Button) - "Confirm"
│   ├── LayoutButtonsContainer (Horizontal Layout Group)
│   │   ├── XboxLayoutButton (Button) - "Xbox"
│   │   └── PSLayoutButton (Button) - "PlayStation"
│   └── LayoutIndicators (Horizontal Layout Group)
│       ├── XboxIndicator (Image)
│       └── PSIndicator (Image)

Step 2: Create Controller Item Prefab

  1. Create a new GameObject in your scene
  2. Add a ControllerItem component to it
  3. Add a Button component (add it as a separate component or use existing)
  4. Create the structure:
ControllerItemPrefab
├── Background (Image - for button)
├── ControllerNameText (TMP_Text)
├── LayoutText (TMP_Text)
└── SelectionHighlight (Image - hidden by default)
  1. Drag the whole thing to your Prefabs folder
  2. Delete it from the scene

Step 3: Wire Up References in Unity Editor

For JoystickDetectionView: - Drag your prefab to controllerItemPrefab - Drag the container to controllerListContainer - Assign all Text references - Assign all Button references - Assign the Image indicators - Set colors (e.g., Selected: Green, Unselected: Gray)

For JoystickDetectionPage: - Auto-finds JoystickDetectionView (or assign manually) - Set firstSelectedButton to your RefreshButton

For ControllerItem Prefab: - Assign ControllerNameText, LayoutText, SelectionHighlight - Assign the Button component - Set colors

Step 4: Add to Your Menu System

Find where you have a "Settings" button or similar in your main menu. Add a button handler:

// In your main menu controller or settings controller:
public JoystickDetectionPage joystickDetectionPage;

public void OnJoystickDetectionButtonClicked()
{
    MenuController.instance.PushPage(joystickDetectionPage);
}

That's it! The system is now integrated.

How It Works

  1. User clicks your "Detect Controller" button
  2. JoystickDetectionPage opens and automatically scans for controllers
  3. Shows list of detected controllers with their names and auto-detected layout
  4. User can:
  5. Click "Refresh" to rescan
  6. Select a different controller from the list
  7. Override the layout (Xbox/PS) if detection is wrong
  8. Click "Confirm" to apply the selection
  9. Page closes and the controller layout is now set

Testing

  1. Connect a controller (Xbox or PS)
  2. Run the game
  3. Click your "Detect Controller" button
  4. You should see the controller listed with its name
  5. Verify the layout is correctly detected
  6. Try clicking the Xbox/PS buttons to override
  7. Click Confirm

Common Issues

"No controllers detected" even when one is connected: - Click "Refresh" button - Make sure controller is properly connected - Try unplugging and reconnecting

Wrong layout detected: - Use the Xbox/PlayStation buttons to manually set the correct layout - The system will remember your selection

Page doesn't open: - Make sure you've assigned the joystickDetectionPage reference - Check that MenuController.instance is not null - Verify the Page component is on your UI panel

Remote Play

For Steam Remote Play or similar: 1. Start the game remotely 2. Connect controller to the remote client 3. Open the joystick detection page 4. Click "Refresh" - it should detect the controller 5. Confirm and you're ready to play!

Need More Details?

See JoystickDetectionSystem.md for complete API reference, advanced usage, and troubleshooting.