📖 DYNAMIC SETTINGS & KEY REBINDING SYSTEM (UI Toolkit)
The Complete Plug-and-Play Dynamic Settings Menu & Key Rebinding Solution for Unity.
🌟 OVERVIEW
The **Dynamic Settings & Key Rebinding System** is a zero-code, UI Toolkit framework designed for Unity developers. Built on top of Unity's modern **UI Toolkit** and **New Input System**, it allows you to construct fully functional settings menus, dynamic key-binding screens, and real-time hardware icon prompts in minutes without writing a single line of C\# code.
✨ KEY FEATURES
- ⚡ Zero-Code Custom Inspector: Build tabs, sliders, toggles, dropdowns, and keybinding panels directly from the Unity Inspector facade.
- 🎮 Virtual Single Combination Engine: Supports both single keys (e.g., E) and modifier combinations (e.g., CTRL + E) seamlessly in a single binding slot using asynchronous C\# state timers.
- 🕹️ Gamepad Hardware Brand Detection: Automatically detects connected gamepads (**Xbox, PlayStation, Nintendo Switch, Generic**) and switches UI icons in real-time.
- 🔍 Dynamic Token Resolver: Replace \{ACTION\_NAME\} tokens in your UXML/C\# strings (e.g. "Press \{JUMP\} to Jump!") with auto-updating sprite key icons at runtime.
- 🔄 Real-Time Active Device Switcher: Instantly switches between Keyboard/Mouse and Gamepad layouts when the player touches a controller or presses a key.
- 🎨 Visual Theme Builder & Runtime Theme Switcher: Edit USS styles, colors, and margins directly from the Inspector with a built-in USS generator, and switch between Light/Dark themes dynamically at runtime.
- 🛠️ One-Click Input Action Patcher Tool: Automatically upgrades standard InputActionAsset actions to support combinations without breaking existing setups.
- ♿ Gamepad Navigation & Smooth Scroll: Fully accessible 2D spatial navigation with auto-scrolling focus manipulators for TV and console displays.
- 🌐 Localization & Multi-Language Support: Optional Integration: Works seamlessly with com.unity.localization if installed.
📂 PACKAGE STRUCTURE
```
/Assets/SettingsUI/
├── Documentation/ # Quick Setup Guide PDF / Readme
│
├── Prefabs/ # Ready-to-use Settings System Prefab
│
├── Preset/ # Ready-to-use Assets (TokenNameTable, Input Action, TextSettings, PanelSettings)
│
├── Scripts/
│ │
│ ├── Core/
│ │ ├── ConflictSolver.cs # Pure C# Key Conflict Resolution
│ │ ├── DynamicSettingsBuilder.cs # Primary Menu Skeleton Builder
│ │ ├── DynamicTokenResolver.cs # Runtime Token & Icon Parser
│ │ ├── TokenNameTable.cs # Hardware Brand Database
│ │ ├── RebindController.cs # Shadow Component & UI Orchestrator
│ │ ├── RebindManager.cs # Pure C# Input System Operations
│ │ ├── SettingsDataStructures.cs # Serialized Structures & Enums
│ │ ├── SmoothScrollManipulator.cs # Focus-Based Smooth Scroller
│ │ ├── SpatialNavigator.cs # Handles 2D Spatial Navigation and Focus Management
│ │ └── SettingsMenuManager.cs # Manages the Pause/Menu toggle state (Open/Close).
│ │
| ├── Editor/
│ │ ├── DynamicSettingsBuilderEditor.cs # Main Builder Custom Inspector
│ │ ├── TokenNameTableEditor.cs # Hardware Database Custom Editor
│ │ └── InputActionPatcher.cs # One-Click Combination Upgrade Tool
│ │
| └── Helpers/
│ ├── AudioDeviceHelper.cs
│ ├── HUDScaleHelper.cs
│ ├── PipelineRenderScaleHelper.cs
│ ├── PresetManager.cs
│ └── ResolutionHelper.cs
│
├─ UI/ # UXML Templates & USS Stylesheets
│ ├── Fonts/ # Fonts for Titles, Subtitles and Main Texts
│ ├── Textures/ # Gamepad Icon Sprite Sheet Assets & Textures
│ ├── ControlsPanelTemplate.uxml # Control Binding Tab Template
│ ├── ControlsRow.uxml # Control Binding Row
│ ├── DropdownRow.uxml
│ ├── SectionHeaderRow.uxml
│ ├── SettingsMenuTemplate.uxml
│ ├── SettingsStyles.uss
│ ├── SliderRow.uxml
│ ├── TabButton.uxml
│ └── ToggleRow.uxml
│
└── Demo/ # Isolated Demo Scene & Example Managers
└── o o o
❓ TROUBLESHOOTING & FAQ
Q: Key bindings show \[ - \] or don't render on the screen.
- A1: Ensure Control Row Template (ControlRow.uxml) is assigned in the Inspector of RebindController.
- A2: Clear saved test bindings by going to Unity top menu: Edit -\> Clear All PlayerPrefs.
Q: How does the system handle key binding conflicts (e.g., assigning 'E' to Jump when 'E' is already mapped to Interact)?
- A: When a key conflict is detected, the built-in `ConflictSolver` automatically triggers an interactive Conflict Resolution Modal (Popup) prompting the player with two choices:
• Cancel: Aborts the rebinding process and retains the original key assignment.
• Rebind: Assigns the new key to the target action and automatically sets the conflicting action (e.g., Interact) to **UNBOUND** to prevent duplicate inputs.
Q: Gamepad Sprite Icons show as literal text like \<sprite name="..."\>.
- A: Make sure rich text is enabled on your UI elements and your Sprite Asset is assigned to your UI Panel Settings:
1. Go to your active `Panel Settings` asset.
2. Expand `Text Settings` -> `Sprite Assets`.
3. Drag and drop `TokenSpriteSheet` into the list.
Q: Can I use both Keyboard and Gamepad combinations (e.g. CTRL+W and RT+A)?
- A1: Yes! Ensure you run Tools -\> Input Action Patcher on your Input Action Asset to convert standard actions into ButtonWithOneModifier composites.
Q: How can I reset all settings and keybindings back to factory defaults via code?
- A: You can call `settingsBuilder.ResetAllSettings()`. This will clear saved PlayerPrefs overrides, restore default InputAction bindings, and automatically refresh the entire menu UI.
Q: Can I add support for custom/unsupported Gamepad brands or custom button icons?
- A: Yes! Open `TokenNameTable.asset` in your Inspector. You can add new control paths, map custom sprite names per hardware platform (Xbox, PlayStation, Switch, Generic), or adjust global icon display scale.