Page 1 of 1

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

Posted: Mon Apr 24, 2023 9:40 am
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.

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

Posted: Mon Apr 24, 2023 10:32 am
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.

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

Posted: Mon Apr 24, 2023 11:14 pm
by robster21
I did it, but the problem hasn't been solved yet.
Did I do something wrong?

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

Posted: Tue Apr 25, 2023 7:45 am
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.

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

Posted: Tue Apr 25, 2023 10:34 am
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.

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

Posted: Tue Apr 25, 2023 10:50 am
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().

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

Posted: Tue Apr 25, 2023 9:07 pm
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.)

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

Posted: Tue Apr 25, 2023 9:23 pm
by Tony Li
Great! I'm glad you got it working.