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 Refresh System - Setup Guide¶
Overview¶
Simple joystick detection refresh system for your game. When a user clicks the "Detect Joystick" button in settings, a popup appears showing the number of connected controllers, with a refresh button to rescan and update the joystick names.
Current Implementation Status¶
IN USE: JoystickRefreshPanel - Simple popup for controller detection NOT IN USE (commented out): - JoystickDetectionPage - Complex page with controller selection - JoystickDetectionView - List of detected controllers with layout override - ControllerItem - Individual controller items
The complex system with controller selection and Xbox/PlayStation layout override has been created but is currently commented out. You can uncomment and use it later if you need those features.
What Was Created¶
1. Enhanced InputManager (Assets/Script/App/Managers/InputManager.cs)¶
- Added
RefreshJoysticks()- Rescans for connected controllers - Added
GetConnectedJoystickCount()- Returns number of connected controllers - Added
GetDetectedJoystickNames()- Returns array of joystick names - Added
ControllerLayoutenum - Xbox/PlayStation layout types - Added
DetectControllerLayout()- Detects layout from joystick name
2. JoystickRefreshPanel (Assets/Script/App/UI/Views/JoystickRefreshPanel.cs) - CURRENTLY IN USE¶
Simple popup component that: - Shows joystick detection status - Displays number of detected controllers - Has a Refresh button to rescan - Has a Close button - Auto-hides after 3 seconds - Updates joystick names in the UI when refreshed
3. Updated SettingsInterface (Assets/Script/Game/Utilities/SettingsInterface.cs)¶
- Added
JoystickRefreshPanelreference field - Added
OnDetectJoystickButtonClicked()method to show the panel
4. JoystickDetectionPage, JoystickDetectionView, ControllerItem - COMMENTED OUT¶
These files exist but are currently not in use. They provide: - Full page integration with MenuController - List of all detected controllers - Controller selection - Manual Xbox/PlayStation layout override - Can be uncommented and used in the future if needed
Unity Setup Steps (5 minutes)¶
Step 1: Create the Refresh Panel UI¶
- In your Settings scene, create a new UI Panel (Right-click > UI > Panel)
- Name it "JoystickRefreshPanel"
- Make it a child of your Canvas (but not inside other panels)
- Add the
JoystickRefreshPanelcomponent to it - Create this structure under the panel:
JoystickRefreshPanel (JoystickRefreshPanel component)
├── Background (Image)
├── PanelContent (Vertical Layout Group)
│ ├── StatusText (TMP_Text) - "1 controller detected"
│ ├── JoystickCountText (TMP_Text) - "1"
│ ├── ButtonsContainer (Horizontal Layout Group)
│ │ ├── RefreshButton (Button) - "Refresh"
│ │ └── CloseButton (Button) - "Close"
Step 2: Configure JoystickRefreshPanel Component¶
Assign references in the Inspector: - statusText: Drag the StatusText TMP_Text component - joystickCountText: Drag the JoystickCountText TMP_Text component - refreshButton: Drag the RefreshButton - closeButton: Drag the CloseButton - panelGameObject: The panel GameObject itself (should auto-assign) - autoHideDelay: Keep at 3 seconds (or adjust as needed)
Important: Make sure the panel is initially disabled (GameObject unchecked in Inspector)
Step 3: Wire Up the Detect Joystick Button¶
- Find your
detectJoystickButtonin your settings UI - In the Button component's
OnClick()event: - Click the
+button - Drag your
SettingsInterfaceGameObject to the object slot - Select
SettingsInterface.OnDetectJoystickButtonClickedfrom the function dropdown
Step 4: Link the Refresh Panel to SettingsInterface¶
- Select your
SettingsInterfaceGameObject - In the Inspector, find the new "Joystick Refresh Panel" section
- Drag your
JoystickRefreshPanelGameObject to thejoystickRefreshPanelfield
Step 5: Test It¶
- Enter Play mode
- Open your settings menu
- Click the "Detect Joystick" button
- The popup should appear showing controller count
- Click "Refresh" - it should rescan and update the count
- The joystick names in your settings should update
- The panel should auto-hide after 3 seconds (or click Close)
How It Works¶
- User clicks "Detect Joystick" button in settings
- JoystickRefreshPanel shows with current controller count
- User clicks Refresh:
- Calls
InputManager.RefreshJoysticks()to rescan - Updates the displayed count
- Calls
GameSettings.JoystickSetUI()for both players - This updates the joystick names displayed in settings
- Panel auto-hides after 3 seconds (or user clicks Close)
Troubleshooting¶
Panel doesn't appear when button clicked¶
- Check that
detectJoystickButtonhas theOnDetectJoystickButtonClicked()function assigned - Verify
joystickRefreshPanelfield in SettingsInterface is assigned - Make sure the panel GameObject is disabled initially (unchecked in Inspector)
Joystick names don't update¶
- Check that
GameSettings.Instanceis not null - Verify that
JoystickSetUI()is being called (add Debug.Log if needed) - Make sure Save data has correct preset IDs
Compilation error about JoystickRefreshPanel¶
- Unity might need a moment to compile the new file
- If error persists, try Assets > Reimport All
- Move JoystickRefreshPanel.cs to the same folder as SettingsInterface.cs
Panel doesn't auto-hide¶
- Check that
autoHideDelayis set to a reasonable value (3 seconds) - Make sure no other scripts are interfering with the panel
Remote Play Scenario¶
For Steam Remote Play or similar:
- Start the game remotely
- Connect controller to the remote client
- Open settings and click "Detect Joystick"
- Click "Refresh" - it will detect the new controller
- Joystick names in settings will update to show the connected controller
- Players can now use the controller!
Current Controller Setup¶
Your system has: - 2 Keyboard presets (P1_Keyboard, P2_Keyboard) - 2 Joystick presets (P1_Joystick, P2_Joystick) - Joysticks activate automatically when plugged in - The refresh button just updates the joystick names displayed in settings
Notes¶
- The InputManager enhancements are already in place from the previous joystick detection work
- This is a minimal solution focused on your specific need
- No complex controller selection or layout switching needed
- Simply shows count and refreshes the joystick list