I'm struggling to scroll between dialogue options. Any help would be appreciated!

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
benwesorick
Posts: 3
Joined: Wed Mar 03, 2021 5:37 pm

I'm struggling to scroll between dialogue options. Any help would be appreciated!

Post by benwesorick »

Hello!

Apologies as I'm sure this has already been covered before but I cannot seem to find the solution after extensive googling.

I have two dialogue options. I want the player to be able to scroll between the two options, with the text color changing from a default of white to yellow when scrolled to. From there, I'd like to select/lock in the highlighted dialogue choice by left-clicking. I don't want the dialogue options to move, I just want to change which option is currently highlighted yellow with the scroll wheel input and then select the highlighted option with a click. It sounds so simple but I cannot figure it out for the life of me and I fear I've made things worse with my attempts (I'm building off the Basic Standard Dialogue IU precomp). Right now the scroll wheel input and mouse click inputs do not seem to be recognized.

Here is my current setup:
Scroll Rect
Image
Scroll Content
Image
Response Button pt 1
Image
Response Button pt 2
Image
Reponse text
Image

Do I need to add new scripts or just adjust the settings of what I currently have?
Thanks in advance!
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: I'm struggling to scroll between dialogue options. Any help would be appreciated!

Post by Tony Li »

Hi,

Inspect the Dialogue Manager GameObject, and tick the Input Device Manager component's Always Auto Focus checkbox. Auto Focus sets the selection focus to the first response menu button when the response menu appears. This allows the user to navigate UI elements using the Horizontal and Vertical Axis inputs defined on the scene's EventSystem GameObject.

Normally when the Input Device Manager detects that you're using a mouse, it turns off auto focus. If you tick Always Auto Focus, it will continue to auto focus even when using a mouse.

By default, the EventSystem's Horizontal and Vertical Axis are set to the input definitions "Horizontal" and "Vertical". If you change the Vertical Axis to "Mouse ScrollWheel", it will use the mouse scroll wheel to navigate UI elements. Select Edit > Project Settings > Input, and change the Mouse ScrollWheel input's Sensitivity to 1. Otherwise it will take way too much scrolling to change selections.

You may also be interested in the Firewatch-style example scene available on the Dialogue System Extras page. It uses the scroll wheel to navigate response buttons.
benwesorick
Posts: 3
Joined: Wed Mar 03, 2021 5:37 pm

Re: I'm struggling to scroll between dialogue options. Any help would be appreciated!

Post by benwesorick »

Thanks Tony! I have scroll functionality! I'm able to scroll between dialogue options now. Unfortunately, when I click it does not select the highlighted option. There is some recognition because it changes color, and when I'm on the second option and click it resets back to highlight the first option, but it doesn't progress to the next dialogue. Only 'E' or 'Enter' progress the conversation. I tried switching 'entre' to 'Fire1' in the Input manager but Unity wouldn't appear to let me. I also tried changing Submit to Fire1 in the Standalone Input Module but that didn't work. And nothing I did in the Input device script seemed to work either. Any suggestions?

Image
Image

Thanks again for the help so far!
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: I'm struggling to scroll between dialogue options. Any help would be appreciated!

Post by Tony Li »

Unfortunately that's part of a feature that people are still waiting to be built in. When the EventSystem has a default StandaloneInputModule, a mouse click anywhere will deselect whatever button is currently selected and then try to select whatever button is under the mouse position, if any.

The Dialogue System's Always Auto Focus checkbox at least puts focus back on a response button in the menu so you can continue navigating up and down, but by that point the StandaloneInputModule has consumed the mouse click event so it isn't handled as a Submit input.

Currently you have to write a custom input module script to prevent this behavior. This answer explains how:

https://answers.unity.com/questions/101 ... ct-in.html

The base input module script that you'll copy is here:

https://github.com/Unity-Technologies/u ... putModules
benwesorick
Posts: 3
Joined: Wed Mar 03, 2021 5:37 pm

Re: I'm struggling to scroll between dialogue options. Any help would be appreciated!

Post by benwesorick »

Shoot. Well, thanks for pointing me in the right direction. You're the best Tony!
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: I'm struggling to scroll between dialogue options. Any help would be appreciated!

Post by Tony Li »

Glad to help. Sorry Unity UI doesn't make that thing very easy. But if you follow the guidance in the Unity answer (If I recall correctly, it's just one line of code commented out), it should work fine.
Post Reply