Starting a conversation makes the button not work for anything else anymore

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
musicROCKS013
Posts: 9
Joined: Fri Jan 03, 2025 8:29 pm

Starting a conversation makes the button not work for anything else anymore

Post by musicROCKS013 »

I am using the New Input System and have an input action asset. I have set it up and it works so that when I enter the dialogue system trigger and press "X," the conversation will start. I have also followed the instructions so that pressing X during the conversation emulates pressing the "continue button."

The issue comes up after the conversation is finished. The "X" input action always seems to register as false after the conversation. It works fine before, but afterwards it just doesn't work.

Things to note:
- Input debugger shows it is being pressed
- There is only one conversation in the scene, attached to this object.
- The input stops after the conversation ends. It still correctly registers as true while the conversation is going.
- It is only this input that stops working. It is the only one I have registered with the input device manager.

I am using a player input component, and the code looks like this.

Code: Select all

if(GetComponent<PlayerInput>().currentActionMap.FindAction("X").ReadValue<float>() == 0)
{
      // not pressed
}
else
{
      // pressed
}

Just wondering if anything in the dialogue system might be affecting this. Any help is appreciated. Thanks!


Edit: Forgot to mention, the button still works with re-starting the conversation. That is, once I've finished the conversation, the button won't register to anything else anymore, but will still work with the dialogue system. In the registration demo script, there's this comment.

Code: Select all

// Track which instance of this script registered the inputs, to prevent
// another instance from accidentally unregistering them.
Maybe I'm mixing up the instances? If that's the issue, how do I keep from mixing them up, and only use the one in the player input component?

Edit 2: I think that I found the source of the bug! To make "X" click the continue button and progress the text, I followed this post:https://www.pixelcrushers.com/phpbb/vie ... php?t=6167

In it, I had to use the "UI Button Key Trigger" Script, and attach it to the Continue button object in the dialogue prefab. Once the text was over, I enabled the continue button and all of its parent's, and the X button worked again! I suspect that the "Input Action" field is somehow conflicting with the other instances of my action map. However, I'm still not sure how to fix this without enabling all of the button's parents afterwards, or why this is even happening.

Edit 3: I was able to fix the issue! I edited part of the "UI Button Key Trigger" script that disables the Input Action when the script is disabled. Since the script is disabled at the very end of the conversation, it also disables the use of the "X" key. However, I don't love editing code written by someone else and I'm worried it might break something else or lead to memory leaks or something. If there's a more established way to do this, please let me know. Thanks!
User avatar
Tony Li
Posts: 23254
Joined: Thu Jul 18, 2013 1:27 pm

Re: Starting a conversation makes the button not work for anything else anymore

Post by Tony Li »

Hi,

This updated UIButtonKeyTrigger script will be in the next release. It adds a "Disable Input Action After Click" checkbox that is UNticked by default, so it won't disable the input action:

PixelCrushers_UIButtonKeyTriggerInputSystemPatch_2025-01-20.unitypackage
musicROCKS013
Posts: 9
Joined: Fri Jan 03, 2025 8:29 pm

Re: Starting a conversation makes the button not work for anything else anymore

Post by musicROCKS013 »

Worked perfect! Thanks so much!
User avatar
Tony Li
Posts: 23254
Joined: Thu Jul 18, 2013 1:27 pm

Re: Starting a conversation makes the button not work for anything else anymore

Post by Tony Li »

Glad to help!
Post Reply