Continue button not working after controller disconnect

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
mgregoirelds
Posts: 106
Joined: Wed Aug 23, 2017 4:10 pm
Location: Canada

Continue button not working after controller disconnect

Post by mgregoirelds »

Hello Tony,

I'm having an issue where my controller turns off by itself while playing (I'm using an Xbox One wireless controller) and for some reason, when I turn it back on again, pressing to continue a dialogue doesn't work anymore. I'm using Rewired. What is funny is that everything else is working when I turn back my controller: I can run, attack and other stuff, so my guess is that something is happening with Dialogue System. It seems like "eventSystem.currentSelectedGameObject" is set to null at this point, so submitting the key doesn't work. Any idea?
Unity 2022.3.17f1
Dialogue System 2.2.44.1
OpenAI Addon 1.0.12
mgregoirelds
Posts: 106
Joined: Wed Aug 23, 2017 4:10 pm
Location: Canada

Re: Continue button not working after controller disconnect

Post by mgregoirelds »

Maybe it is related to the autofocus option? I can't find it anymore in 2.0. I've taken a look at calls within Dialogue System to UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(null) and it is done in UnityUIDialogueUI. Could it be that the Continue button is never reselected? I'm using Standard Dialogue UI with TMP.
Unity 2022.3.17f1
Dialogue System 2.2.44.1
OpenAI Addon 1.0.12
User avatar
Tony Li
Posts: 22058
Joined: Thu Jul 18, 2013 1:27 pm

Re: Continue button not working after controller disconnect

Post by Tony Li »

Hi Maxime,

In the Standard Dialogue UI, the Standard UI Subtitle Panel and Standard UI Menu Panel have a Navigation section. Make sure the Focus Check Frequency is non-zero. Try setting the Refresh Selectables Frequency to a non-zero value such as 1.

When the panel opens, it will cache a list of all buttons it contains. Then it will select the button assigned to First Selected, if assigned. If the Focus Check Frequency is non-zero, on a repeating frequency it will check that a button is selected; if not, it will select one of the buttons in its cache. If Refresh Selectables Frequency is non-zero, it will refresh the cache on a repeating frequency.

Image

However, it will not do this if the Input Device Manager's Input Device is set to Mouse or Touch. The Input Device Manager component is on the Dialogue Manager GameObject.

Note that if you move the mouse, it will change the Input Device to Mouse. (Unless you've unticked Detect Mouse Control. If your Input Device Manager doesn't have a Detect Mouse Control checkbox, you'll need to update to the patch if you want to get it.)

Image

To identify the issue, try this in the Unity editor:

1. Keep the inspector on the Input Device Manager. When the problem occurs, check the Input Device Manager's Input Device value. Make sure it's Joystick or Keyboard.

2. If that doesn't help, keep the inspector on the Event System. (Or open two Inspector windows, lock one on the Event System, and lock the other on the Input Device Manager.) When the problem occurs, check what the EventSystem thinks is selected:

Image

If neither of those help, it might be specific to the Rewired integration. I'm going to test that right now. Can you test it temporarily without the Rewired integration to see if there's a difference? I'll let you know what I find in my test.
mgregoirelds
Posts: 106
Joined: Wed Aug 23, 2017 4:10 pm
Location: Canada

Re: Continue button not working after controller disconnect

Post by mgregoirelds »

At the same time you were writing your message, I tested out something and I think I found the problem. We had "Detect Mouse Control" checked, so when the controller was not connected, it did fall back to Mouse. Then, upon reconnecting, it stayed in Mouse mode. Why? I'm not sure... Maybe I'm missing some sort of proper Rewired integration, I'm not sure.
Unity 2022.3.17f1
Dialogue System 2.2.44.1
OpenAI Addon 1.0.12
User avatar
Tony Li
Posts: 22058
Joined: Thu Jul 18, 2013 1:27 pm

Re: Continue button not working after controller disconnect

Post by Tony Li »

If you haven't already done this, please try it:

1. Import the Rewired Support package in Plugins / Pixel Crushers / Common / Third Party Support.

2. Add an Input Device Manager Rewired component to the Dialogue Manager.
mgregoirelds wrote: Wed Jul 04, 2018 10:04 pmWe had "Detect Mouse Control" checked, so when the controller was not connected, it did fall back to Mouse. Then, upon reconnecting, it stayed in Mouse mode. Why?
For efficiency, the Dialogue System's Input Device Manager doesn't continuously poll for a joystick. Instead, it switches back to Joystick mode only if the player presses any of the Joystick Key Codes To Check, or Joystick Buttons To Check (buttons defined in Unity's Input Manager), or Joystick Axes To Check (also defined in Unity's Input Manager). By default, the buttons and axes lists are empty, but the primary joystick key codes are in the list.


I made these changes to a default test scene, and it appears to work even with Detect Mouse Control ticked:

1. Imported Rewired. Set up joystick actions UIHorizontal, UIVertical, UISubmit, and UICancel.

2. Inspected the EventSystem. Removed the Standalone Input Module, and added a Rewired Standalone Input Module.

3. Set up the Rewired Support integration as described at the top of this post.

4. (Optional:) Inspected NPC Subtitle Panel, PC Subtitle Panel, and Response Menu Panel. Set Navigation > Refresh Selectables Frequency to 1. Setting it to 1 is a good safety measure. But it worked with the value set to 0 as well.
User avatar
Tony Li
Posts: 22058
Joined: Thu Jul 18, 2013 1:27 pm

Re: Continue button not working after controller disconnect

Post by Tony Li »

I'm finishing work for the day. If it's still giving you problems, please feel free to send me a reproduction scene. I can test it out here tomorrow morning and let you know what I find.
mgregoirelds
Posts: 106
Joined: Wed Aug 23, 2017 4:10 pm
Location: Canada

Re: Continue button not working after controller disconnect

Post by mgregoirelds »

Hello, we just shipped our demo with the Detect Mouse Control unticked. So far, it worked fine. I'll see about making the proposed changes later today. Thanks a lot Tony!
Unity 2022.3.17f1
Dialogue System 2.2.44.1
OpenAI Addon 1.0.12
User avatar
Tony Li
Posts: 22058
Joined: Thu Jul 18, 2013 1:27 pm

Re: Continue button not working after controller disconnect

Post by Tony Li »

Congratulations on shipping your demo!
Post Reply