In 4.1 we introduced some components to show the correct UI input prompts depending on the current control scheme.
These prompts will try to find a particular action in your game’s ActionMap and then, for a particular scheme, it’ll try to get the binding button sprite in a custom asset.
<aside> ℹ️
This is just for information purposes, the template already contains pre-configured KeyboardAndMouse and Gamepad schemes
</aside>
The template includes 2 different input schemes: KeyboardAndMouse and Gamepad. These have been setup in the action assets (PlayerActions and UIActions)
The project also includes 2 InputSchemeHandles for each of these in HorrorEngine/ExampleContent/Input. Internally, these ScriptableObjects contain the name of the scheme they refer to from the list above (in the Action asset)
If you require any extra scheme, you can create one by adding it to the ActionAsset and then creating the related handle by right clicking on your project and selecting Create→Horror Engine→Input→Input Scheme. Remember to set the Name variable to the same name you used in the input actions asset.
You can convert a static UI sprite into an adaptive input sprite by adding the component UIInputSchemeActionSpriteSetter.
This component has a couple of parameter:
Actions: The action asset which contains the input action you want to bind this sprite to
ActionName: This is the name of your action inside the asset. It’ll have the format [ActionMap]/[ActionName]
Sprite Asset: This is the asset containing the different sprites for each input path (more about this below)
SetSpriteEvent: This event will get called every time a new input device is set as active. Usually we simply want to change the sprite of an Image component. For that purpose, select the sprite properties at the top of the list in the section DynamicSprite and not the one in StaticParameters