Setup UI Input
Multiplayer user interfaces build upon Unity's standard UI Input Module system, utilizing Event Systems and UI Input Modules for interaction. However, they require special configuration for multiple players.
Overview
Each Local Player needs their own Multiplayer Event System with a UI Input Module to interact with the interface. The Setup Local Player UI Input instruction simplifies this process by instantiating and configuring these components automatically.
Setup Local Player UI Input Instruction
This Game Creator 2 instruction configures UI input handling for individual players.
Parameters
- Local Player: The target Local Player for UI input configuration
- Multiplayer Event System Prefab: Prefab containing:
- Multiplayer Event System component
- Properly configured UI Input Module
- First Selected: The GameObject to receive initial focus
- Player Root: (Optional) GameObject that limits UI navigation and interactions to itself and its children
Configuration Tips
Input Action Setup
- Create a dedicated action map for UI controls
- Configure necessary UI input actions:
- Navigation (up, down, left, right)
- Submit/Cancel
- Any additional UI interactions
- Assign the action map to the UI Input Module
Action Map Configuration
Create a separate action map specifically for UI controls to keep your input configuration organized and maintainable.
Input Management
There are two ways to activate UI controls:
- Set the Default Action Map to your UI map when adding a Local Player in menus
- Use the Switch Local Player Input Map instruction to change to UI control dynamically
Action Map Activation
Ensure the correct action map is active when UI interaction is needed. Players won't be able to interact with UI elements if the wrong action map is active.
Technical Details
The Multiplayer Event System is a Unity built-in component that extends the standard Event System for multiplayer scenarios. For detailed information, see the Unity Documentation.
Best Practices
- Create a dedicated UI input prefab for consistency
- Configure clear input action maps for UI interaction
- Consider UI navigation paths when setting up player roots
- Test UI interaction with multiple control schemes (keyboard, gamepad, etc.)