In this tutorial we will integrate Dynamic Input Switching by JmannDX, it is a solution to recognize if the user is on keyboard or on a gamepad and change in-game icons.
1. Create a new FPS Game Starter Kit project
2. Add Dynamic Input Switching to it
3. Open BP_GameMode and set the Player Controller to be DW_PlayerController
The functionality is now available, to make it work, all you need to do is get player controller > Cast to DW_PlayerController > get IsGamepad (bool) > use a branch or select node to set the correct icon on your widgets.
Also worth mentioning is that once you set the player controller to DW_PlayerController you only have to call the “Get Gamepad Controls” function and it’ll pull the IsGamepad bool automatically. So you don’t have to cast all the time.
As an example, let’s change the Press E to Interact prompt as an example
4. Add a new HorizontalBox, make it Hidden and IsVariable, inside it add a text, an image, and another text
5. The image also needs to be a variable, because it’s the one that changes
6. Open BP_CharacterBase and in the InteractPromptVisibility function, replace the old one with the new one we just made
7. Still on the character, same function, recreate this at the end