Managing Inputs
Last updated
Last updated
The asset utilizes the Unity Input System package, which means modifying inputs may differ from the old built-in Unity Input System. If you're unfamiliar with setting up the Input System package, please refer to the guide provided below.
Locate the PlayerControls asset within the UHFPS -> Scriptables -> Input folder. To open the Input Actions window, double-click on the asset.
Upon opening the Input Actions window, you may notice that the action names follow the pattern input.action.something. This is because action names serve as localization keys, allowing for easy translation of action names.
To create a new input action, simply click on the (+) icon found to the right of the Actions tab name. Enter the name of the action in the localization key pattern.
Keep in mind that actions added to the first Action Map (input.map.player) will be only displayed in the Main/Pause menu. This means that these actions can only be rebound and serialized.
Input names containing an asterisk (*) will be automatically excluded from menu display and serialization. For instance, input.action.look* will be disregarded.
Select the newly created action and modify the Action Type to the desired input type.
Next, click on the <No Binding> and choose the key you want your action to utilize.
If you are using a custom controls asset, ensure that you assign the reference to this asset within the Input Manager component.
In order to access input actions within a script, simply use the Input Manager functions. There are multiple ways to utilize the input.
You can find a script called Controls, which stores all the input names so that you don't have to keep typing out the whole input name over and over again.