In PiE "Is Gamepad Key" works and I can detect if Gamepad or Mouse used, but in the packaged game it doesn't. Why?

I want to detect whether the player is using mouse+keyboard or Gamepad, allowing to switch on the fly to change the UI (I’m not using the Enhanced Input System, I want to stick to the old Input System).

Everything works fine in the PiE but not when shipping a build.

The red parts seem to never be triggered in the built game. Even though I can use the Controller to move, the setting persists as Is Gamepad == false.

Any idea why?

imagen

In PiE, changes on the fly:

imagen

imagen

When is the controller / keyboard check run? Are you running it on start or some other location?

You can have a start screen that says “press a key to continue”. That is the only check to see if a controller is in use. That will prevent it from changing depending on how the entire setup is working for you?

If the controller is plugged into the PC, you should disconnect it and try the packaged build again to see if there is some interference or just a mess-up in your code.

Thanks for the reply.

  • Just to make sure: the controller works alongside mouse in the built game.
  • What doesn’t work is the “Is Gamepad Key” flag from UE’s Input system that is not appearing as true when I use the gamepad - even although the gamepad works.
  • Also, this is for a system to allow Mouse+Keyboard AND Controller switching on the fly, during gameplay, like most new games, so I don’t want to force keyboard or controller ONLY.
  • Answering your other questions: my detection code runs on Any Key and the specific Input events. So anytime, not only on startup, as you can see:

imagen

The input is not consumed here.

Turns out there’s nothing wrong with my Input detection code. The problem was the way I was trying to load the input textures on the fly with Get Asset by Object Path, trying to use unreferenced assets that are not cooked with the package.

Works in PiE, not in shipped game.

Solution 1

Add the Prompts image folder to “Additional Asset Directories to Cook”

Source:

Solution 2

Another way to fix it, I created a Data Table mapping keys to all the available prompt images, this way there is a guaranteed indexed source of truth for prompt images referenced when the project is cooked:

imagen