You are free to do whatever you want with this library. You're allowed to use this for commercial projects, edit the source code and even redistribute the source code. No attribution is required (but appreciated)
- Unity 2020.3.11f1
- Unity Input System
This tool allows you to create complex menus without writing a single line of code. It includes to following features
- Keyboard and controller support using the Unity Input System
- Vertical, Horizontal and Tabbed style menus
- Wrap-around when exceeding the start/end positions
- Activated, deactivated, selected and canceled events that can be handled inside the editor
This library includes demo input actions that should be perfect for any game. If you want to create your own, you can follow these steps:
- Right click in the project and select Create > Input Actions
- Use InputActions as the name
- Open the new Input Actions file
- Create a new control scheme
- Create a Menu Action Map
-
Create the following actions:
- Vertical (1D Axis)
- Horizontal (1D Axis composite)
- Tabs (1D Axis composite)
- Select (Button binding)
- Cancel (Button binding)
- Specify the key bindings for each action
Please refer to the official Unity documentation for more information: https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/QuickStartGuide.html
Action | Keyboard | Controller |
---|---|---|
Navigate Up | Up Arrow W Key |
Left Stick Up D-Pad Up |
Navigate Down | Down Arrow S Key |
Left Stick Down D-Pad Down |
Navigate Left | Left Arrow A Key |
Left Stick Left D-Pad Left |
Navigate Right | Right Arrow D Key |
Left Stick Right D-Pad Right |
Tab Previous | Q Key Page Down |
Left Trigger |
Tab Next | E Key Page Up |
Right Trigger |
Select | Enter Key | South Button |
Cancel/Back | Escape Key | East Button |
- Add a new empty game object to your scene
- Add a Menu Input component to this new game object
This Menu Input component will read the input from the Unity Input System (using the InputActions file) and invoke the correct events when needed
- Add a new empty game object to your scene
- Add a Menu component to this new game object
-
Set the properties of the menu
- Active: A boolean value indicating if the menu can receive input events
- Menu Style: The type of menu you're using (Vertical, Horizontal or Tabbed)
- Reset Index After Loading: Reset the selected index after loading the menu (or disabling and enabling it)
- Wrap Around: Enable/disable the wrap-around feature when exceeding the start/end position of the menu
- Menu Items: A list of all menu items managed by this menu
- Set up the canceled event (optional)
- Add a new empty game object to your scene
- Add a Menu Item component to this new game object
- Set up the activated event (optional). This is invoked when the menu item is active
- Set up the deactivated event (optional). This is invoked when the menu item is deactivated
- Set up the selected event (optional). This is invoked when the menu item is selected
- Design the menu item
Remember to add the menu item to the menu. Otherwise no events will be invoked
- Add a new empty game object to your scene
- Add a Menu Device Monitor component to this new game object
- Create device indicators for all the controllers/input devices you support
- Specify all the device indicators in the Menu Device Monitor component
The Menu Device Monitor requires an instance of Menu Input in the same scene
This library includes a demo scene that shows you how to create vertical, horizontal and tabbed menus. It also includes different menus using different features available in the library (including device/input indicators). There's a Input directory that contains an InputActions file that should be perfect for your game