How can I use New Input System with UI Button Key Trigger?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
robster21
Posts: 36
Joined: Tue Aug 23, 2022 9:02 am

How can I use New Input System with UI Button Key Trigger?

Post by robster21 »

I want to use custom action command(New Input System) during a Conversation, but If I assign my action to UI Key Trigger, the command is recognized as a double click.
User avatar
Tony Li
Posts: 21033
Joined: Thu Jul 18, 2013 1:27 pm

Re: How can I use New Input System with UI Button Key Trigger?

Post by Tony Li »

You can assign an Input System's input action to a UI Button Key Trigger component's Button Name, but make sure it's not the same input as the EventSystem's InputSystemUIInputManager > Submit input. Otherwise it will double click.
robster21
Posts: 36
Joined: Tue Aug 23, 2022 9:02 am

Re: How can I use New Input System with UI Button Key Trigger?

Post by robster21 »

I did it, but the problem hasn't been solved yet.
Did I do something wrong?
Attachments
input device manager
input device manager
inputDeviceManager.PNG (49.14 KiB) Viewed 613 times
continue button
continue button
continueButton.PNG (31.51 KiB) Viewed 613 times
new input system
new input system
event_02.PNG (24.36 KiB) Viewed 613 times
event system
event system
event_01.PNG (48.3 KiB) Viewed 613 times
User avatar
Tony Li
Posts: 21033
Joined: Thu Jul 18, 2013 1:27 pm

Re: How can I use New Input System with UI Button Key Trigger?

Post by Tony Li »

What if you do the following instead:
  • On the Dialogue Manager GameObject, tick the Input Device Manager's Always Auto Focus checkbox.
  • On the continue button, remove the UI Button Key Trigger component.
  • On the EventSystem GameObject, set the Input System UI Input Module's Submit input back to UI/Submit.
With this configuration, the Space key will continue.

If you want the left mouse button to also continue regardless of where the player clicks, make the continue button transparent and cover the whole screen. If you want a separate visible continue indicator, you can add that, too, but as an Image instead of a Button. To set up the whole-screen continue button, please see option #2 in this post.


If you don't want to do this, and if you want to proceed with your current approach, may I ask the reason? This will help me provide a more comprehensive answer. Also, if you want to proceed with your current approach, please show the script in which you're registering the Continue action with the Input Device Manager.
robster21
Posts: 36
Joined: Tue Aug 23, 2022 9:02 am

Re: How can I use New Input System with UI Button Key Trigger?

Post by robster21 »

When I display a Menu or a BackLog on the screen during a Conversation, I use this code below to prevent Continue button's On Fast Forward.

Code: Select all

PixelCrushers.UIPanel.monitorSelection = false; // Don't allow dialogue UI to steal back input focus.
PixelCrushers.UIButtonKeyTrigger.monitorInput = false; // Disable hotkeys.
PixelCrushers.DialogueSystem.DialogueManager.Pause(); // Stop DS timers (e.g., sequencer commands).
code from :: https://pixelcrushers.com/phpbb/viewtop ... f=3&t=4345

At this time, I can only prevent On Fast Forward using the UI Button Key Trigger.(when I use only Input Device Manager, It didn't work.)

Also, I'm creating an option for players to key rebinding, through the New Input System.
These are the reasons why I want to use the new input system.
Attachments
I'm using the basic code for registering Continue action
I'm using the basic code for registering Continue action
PlayercontrolRegistration.png (70.4 KiB) Viewed 595 times
User avatar
Tony Li
Posts: 21033
Joined: Thu Jul 18, 2013 1:27 pm

Re: How can I use New Input System with UI Button Key Trigger?

Post by Tony Li »

Hi,

You can make a subclass of UIButtonKeyTrigger and override IsBeingClickedBySubmit() to check if the Input System is registering a click on the button. Or replace it entirely with your own script if you prefer, and configure that script to call the continue button's StandardUIContinueButtonFastForward.OnFastForward().
robster21
Posts: 36
Joined: Tue Aug 23, 2022 9:02 am

Re: How can I use New Input System with UI Button Key Trigger?

Post by robster21 »

Ohhh... Sorry, I didn't know that the New Input System was also available in the Input Device Manager.
I solved my problem using your second answer.
(I put my custom action in the Submit button, and it works properly.)
Attachments
Submit.png
Submit.png (44.7 KiB) Viewed 589 times
User avatar
Tony Li
Posts: 21033
Joined: Thu Jul 18, 2013 1:27 pm

Re: How can I use New Input System with UI Button Key Trigger?

Post by Tony Li »

Great! I'm glad you got it working.
Post Reply