UI doesn't responds with Custom Input Assets

If you decided use the New Input System with UI you can have some problem - UI wouldn't react if you use your custom Input Assets.
By default when you create the Player Input component (by default the field UI Input Module set to None)
7305883--885154--DefaultPlayerInput.JPG
If you after that create the Event System (its create automatically if you create some UI element, by example - button), It have the default value in field Action Asset (DefaultInputActions).
In this case all will work fine, but you "Player Input system" and "UI Input system" will use different Input Action Assets (in my example, the "Player Input system" use the my custom BaseControl.inputactions).
More correctly use the one Input Action Assets and set the field "UI Input Module" (based on official docs - you must set your InputActionAsset in "InputSystemUIInputModule" and link it to your Player Input through the field "UI Input Module")
7305883--885151--DefaultInputSystemUIInputModule.JPG

BUT VERY IMPORTANT (its not writing in docs) you must have correct Control Scheme set for UI Actions (in your InputActionAsset).
You must whether no any schemes (as on picture below) or have right scheme which will activate Action as for your Player Input System and also for UI Input System.
7305883--885166--InputActionsNoControlScheme.JPG
I had problem then I set for Player Input System control scheme which used only the keyboard and its blocked any input actions to UI from mouse, because initial the mouse device was absent in my control scheme (You can set the used Control Scheme for Player Input, but for UI Input System you can't do it, it use the same).

7305883--885166--InputActionsNoControlScheme.JPG

2 Likes

Hello,

Thanks for these details, I think I am experiencing the same/similar issue. I have the same playerinput and event system components as you. I have two action maps, Player (for player movement in game), and UI (for UI navigation). I am trying to switch to UI when in menus, but it doesn not work.

Tried SwitchCurrentActionMap() function which does change the action map, but it still does not work.

What do you mean by "You must whether no any schemes (as on picture below) or have right scheme which will activate Action as for your Player Input System and also for UI Input System."?

This is what I have setup for my action maps, for Player. How could I not use any control schemes here, doesnt it mean the player action map wont work?

Thanks!

7325710--889438--actionMaps.PNG

You don't show the your Action Map for UI, and what type of control scheme you use for Player and for UI. In the scheme you must enable the all devices which you use as for Player as for UI Input. (because at now the UI can't use the separated scheme from Player)


You must not create any scheme or create the one common scheme for Player and UI.

1 Like


In case the "No control schemes" (see on my pic) "will be active" the all devices which you use in all Action Maps

P.S> As a Variant (I didn't check it) you can switch the control at enter and at exit from UI action (e.g. "from Menu")

What worked for me was that when you initially add your UI element that creates the initial canvas and event system, when you click the button to have it change the standalone input module to the new input system UI module, don't touch anything, let it continue using the 'DefaultInputActions' that is shown in the InputSystemUIInputModule object when it is created, and you can still use a custom input actions asset for your player input separately.

8180150--1065341--upload_2022-6-3_22-5-54.png

Thanks for that. I spent ages trying to get it to work.

The post was initially about other issue

If anybody else comes across this issue, my issue was that I LOOKED at the DefaultInputAction Control Schemes, saw that it was called "KeyboardMouse", so I named my control scheme "KeyboardMouse" as it appears here:

8734452--1182360--upload_2023-1-16_9-38-31.png

If you EDIT the control scheme, you'll see that it's ACTUALLY named "Keyboard&Mouse", but the ampersand (&) doesn't show up in the control scheme name in the selection UI (lel)

To ACTUALLY fix this issue, you MUST have a control scheme named "Keyboard&Mouse" like so:
8734452--1182366--upload_2023-1-16_9-42-37.png

setup to use both the Keyboard and Mouse (otherwise the Player Input Manager will detect input from the keyboard and mouse as separate players.)

with UI action map copy+pasted from the default action map asset:
8734452--1182357--upload_2023-1-16_9-37-2.png

Two days of my life gone because of this, hope it helps somebody else ;)

8734452--1182366--upload_2023-1-16_9-42-37.png

9 Likes

[quote=“UnkelRambo”, post:8, topic: 847531]
If anybody else comes across this issue, my issue was that I LOOKED at the DefaultInputAction Control Schemes, saw that it was called “KeyboardMouse”, so I named my control scheme “KeyboardMouse” as it appears here:

If you EDIT the control scheme, you’ll see that it’s ACTUALLY named “Keyboard&Mouse”, but the ampersand (&) doesn’t show up in the control scheme name in the selection UI (lel)

To ACTUALLY fix this issue, you MUST have a control scheme named “Keyboard&Mouse” like so:

setup to use both the Keyboard and Mouse (otherwise the Player Input Manager will detect input from the keyboard and mouse as separate players.)

with UI action map copy+pasted from the default action map asset:

Two days of my life gone because of this, hope it helps somebody else :wink:
[/quote]

OH. MY. GOD. I’ve had this same issue for years and it’s been a constant thorn in my side with the input system. This one thing. This one fix solved all the problems I’ve had for YEARS. THANK YOU! Gah I don’t get how Unity releases things with such silly little bugs in their systems likes this.

1 Like

Oh man, I spent literally 3 days scratching my head over this... I still can't believe that the solution was to rename my scheme to "Keyboard&Mouse". I feel relieved and super sad at the same time...

I found it :

1.select the scheme you want to use
9355646--1308659--1284752-d84665925afc89154dbf1cdd0889f922.png

  1. 9355646--1308659--1284752-d84665925afc89154dbf1cdd0889f922.png select the " Edit Control Scheme ".

3.
Add "Mouse" into list.

  1. ![9355646--1308647--60MVW~D8$3I)J4I]AR)9FHB.png|1318x321](upload://bRyxblTouniz9rL9LHnGsDIml5h.png)

9355646--1308656--~8R_IDQSRJ(IWX`{YH1TODY.png

9355646--1308659--1284752-d84665925afc89154dbf1cdd0889f922.png

[quote=“chbcjl”, post:11, topic: 847531]
I found it :

1.select the scheme you want to use

select the " Edit Control Scheme ".

Add “Mouse” into list.

[/quote]
![9355661–1308671–0WP)C`CN%$F3@R81%4401X.png|713x647

I can't get over how bad the documentation is...

[quote=“UnkelRambo”, post:8, topic: 847531]
If anybody else comes across this issue, my issue was that I LOOKED at the DefaultInputAction Control Schemes, saw that it was called “KeyboardMouse”, so I named my control scheme “KeyboardMouse” as it appears here:

If you EDIT the control scheme, you’ll see that it’s ACTUALLY named “Keyboard&Mouse”, but the ampersand (&) doesn’t show up in the control scheme name in the selection UI (lel)

To ACTUALLY fix this issue, you MUST have a control scheme named “Keyboard&Mouse” like so:

setup to use both the Keyboard and Mouse (otherwise the Player Input Manager will detect input from the keyboard and mouse as separate players.)

with UI action map copy+pasted from the default action map asset:

Two days of my life gone because of this, hope it helps somebody else :wink:
[/quote]

Thank you!!! I was scratching my head for days, trying to figure this out…

OMG... the exact same issue. Everybody knows '&' is a special character... what an annoying bug