Subtitle and progression question

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Passero
Posts: 32
Joined: Thu Jan 18, 2018 1:19 pm

Subtitle and progression question

Post by Passero »

I have configured my dialogue system to always use the Continue button. That's working fine.
I'm also using the Subtitle Chars per second.

What I want is that when the text is still appearing and the user clicks the continue button, instead of going to the next part of the conversation, it shows the entire text. Only if the user clicks continue again, it will move the conversation forward.

A final thing... How can I map a button that will do the same as clicking the continue button.
Passero
Posts: 32
Joined: Thu Jan 18, 2018 1:19 pm

Re: Subtitle and progression question

Post by Passero »

I found a solution for the last one...
I added this script to my text component:

I allows the user to click anywhere in the text area to progress the conversation as well as using the space bar to continue.
I'll change it to GetButton to make it more dynamic but anyway, it works :)

Now getting the other parts of the question sorted :)

Code: Select all

public class ContinueOnClick : MonoBehaviour, IPointerClickHandler {

    public UnityUIContinueButtonFastForward button;

    public void OnPointerClick(PointerEventData eventData) {
        if(eventData.button == 0) {
            button.OnFastForward();
        }
    }

    private void Update() {
        if (Input.GetKeyDown(KeyCode.Space)) {
            button.OnFastForward();
        }
    }
}
User avatar
Tony Li
Posts: 22061
Joined: Thu Jul 18, 2013 1:27 pm

Re: Subtitle and progression question

Post by Tony Li »

Hi,

That'll work, or you can resize the continue button to cover the entire text area (or the entire screen if you prefer), and set its image's alpha to zero to make it invisible.
Passero wrote: Fri Jan 19, 2018 6:57 amA final thing... How can I map a button that will do the same as clicking the continue button.
Two ways:

1. On the Unity UI Dialogue UI component, if you tick Auto Focus it will automatically focus the continue button when showing a subtitle. When showing the response menu, it will automatically focus the first response button. Then Unity UI's default Submit input button will click it. In a vanilla project, the Submit input is mapped to Space and Return.

2. Add a UI Button Key Trigger component, and assign a key code and/or input button.
Passero
Posts: 32
Joined: Thu Jan 18, 2018 1:19 pm

Re: Subtitle and progression question

Post by Passero »

Thanks but that's what I already figured out in the code above.

What I am still trying to figure out is that while the text is appearing, if you press the continue button, it will show the entire text instead of moving to the next part.
Only if all the text is displayed, the continue button needs to move to the next part.
User avatar
Tony Li
Posts: 22061
Joined: Thu Jul 18, 2013 1:27 pm

Re: Subtitle and progression question

Post by Tony Li »

That's what the UnityUIContinueButtonFastForward component does. You can test this out in this scene: Assets / Dialogue System / Examples / Unity UI Examples / Generic UI Example Scene. Inspect the Dialogue Manager, and set Subtitle Settings > Continue Button to Always. Then play the scene and talk to Private Hart. The first two subtitles are really short, but the third subtitle is long enough that you should have time to click the continue button to see it fast forward to the end of the text (i.e., show the entire text). Then the second click should progress the conversation.

If it's not working that way in your scene, let me know; we can get to the bottom of it.
Passero
Posts: 32
Joined: Thu Jan 18, 2018 1:19 pm

Re: Subtitle and progression question

Post by Passero »

Yes so that's exactly what I have...
My continue button has the Unity UI Continue Button Fast Forward.
If I click it, he jumps to the next bit of the conversation.

The Continue button is set to always in the Dialogue Manager.
User avatar
Tony Li
Posts: 22061
Joined: Thu Jul 18, 2013 1:27 pm

Re: Subtitle and progression question

Post by Tony Li »

Are the fields set in the Unity UI Continue Button Fast Forward component? (You can compare yours with the setup in the Generic UI Example Scene.) If the Typewriter Effect field isn't set to the NPC subtitle's typewriter effect, it will jump to the next bit of the conversation instead of telling the typewriter effect to fast forward to the end.

Feel free to send an example scene to tony (at) pixelcrushers.com if nothing jumps out at you. I'll be happy to take a look.
Passero
Posts: 32
Joined: Thu Jan 18, 2018 1:19 pm

Re: Subtitle and progression question

Post by Passero »

Ah the typewriter effect was the problem here.
I have a customized UI and I know I copied some things from the example UI after which I removed it. The typewriter effect was set to None and as soon as i dropped the correct one in, it worked like a charm.

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

Re: Subtitle and progression question

Post by Tony Li »

Happy to help!
Post Reply