OnContinue once makes all subtitles play superfast

Announcements, support questions, and discussion for the Dialogue System.
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

OnContinue once makes all subtitles play superfast

Post by nicmar »

I'm trying to make a button that covers the screen (yellow in the video, but will be invisible) that is shown when a conversation happens, that you can click, and it will skip to the end of the dialogue, then to the next bubble, similar to this thread: https://www.pixelcrushers.com/phpbb/vie ... php?t=1196.

First of all, I had problems using dialogueUI.OnContinue, as I have two different dialogue panels, one for the player, and one for the npc. Both are shown slightly at the same time (one hides when the next one shows). So I didn't understand how to use a single DialogeUI and get the typewriter from there.

However, this is what I'm doing:
1) Get the current speaking actor.
2) Get the CustomStandardUISubtitlePanel it's using
3) Run the OnContinue() method on it

The problem is what you see in the video, it skips that subtitle, then plays 0.5 of every subtitle, and keeps skipping to the next. I only run OnContinue once, so I can't see why this should happen. I have the debug log also so you might be able to see something in there.

Any idea what's going on, and is there any better way of getting the current SubtitlePanel, or another way to send a OnContinue-message, that won't be as crazy as this?

Also I have WaitForMessage(Forever) in the sequencer as you can see in the logs. I attached the CustomSkipButton script too.

Thank you in advance!

Code: Select all

var currentSpeaker = DialogueManager.currentConversationState.subtitle.speakerInfo.transform;
if (currentSpeaker == null) return;


uiSubtitlePanel = currentSpeaker.GetComponentInChildren<CustomStandardUISubtitlePanel>();
if (uiSubtitlePanel == null) {
	Debug.Log("No uiSubtitlePanel found");
	return;
}
Attachments
CustomSkipButton.cs.zip
(2.6 KiB) Downloaded 47 times
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnContinue once makes all subtitles play superfast

Post by Tony Li »

Hi Niclas,

The video is private, so I couldn't view it. I have a question, though:

When you click the button that covers the screen, do you want the conversation to skip through all dialogue entries until it reaches a player response menu or the end of the conversation? Or do you want it to only skip the current dialogue entry?
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

Re: OnContinue once makes all subtitles play superfast

Post by nicmar »

Oops, i forgot to set it unlisted. Now you should see it.

I want the click to first fast forward the type writer til the end, and if it’s at the end, close it and either show the next node, wheter it’s subtitle or player response.

In this code i just try to get skip to next working. If that works i can add the typewriter thing which is already in the code but uncommented.

Thanks :)
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnContinue once makes all subtitles play superfast

Post by Tony Li »

Hi,

Can you just use the regular StandardUIContinueButtonFastForward script?
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

Re: OnContinue once makes all subtitles play superfast

Post by nicmar »

I see that I have StandardUIContinueButtonFastForward in the button already, but disabled.
Am I supposed to use that and add all active panels to the StandardDialogeUI > Subtitle Panels when a conversation starts?

Right now each NPC has their own subtitle panel, but I'm not sure if that's a good idea, or if I should have a prefab that is spawned when someone starts talking, and add it to the StandardDialogeUI?

I guess the typewriter effect setting on the StandardUIContinueButtonFastForward also needs to be changed depending on who's talking? If I add all these fields manually, it works.

What is the typical setup to make this work with multiple NPC's and subtitle panels/typewriters? :)

Thank you!
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnContinue once makes all subtitles play superfast

Post by Tony Li »

Hi Niclas,

A typical setup is:

1. Assign a dialogue UI to the Dialogue Manager's Dialogue UI field, such as Basic Standard Dialogue UI. This will probably never be used, but it's good to have something assigned.

2. Add a Dialogue Actor component to each character.
  • Set the Actor dropdown.
  • Set Dialogue UI Settings > Subtitle Panel Number to Custom.
  • Assign your bubble subtitle panel. I recommend assigning a prefab.
3. Edit your bubble subtitle panel prefab.
  • Add a typewriter effect.
  • Add a transparent continue button. Add a StandardUIContinueButtonFastForward component to it.
  • Leave the StandardUIContinueButtonFastForward's Dialogue UI field unassigned; the component will find the UI at runtime.
  • Assign the typewriter effect to the StandardUIContinueButtonFastForward and the StandardUISubtitlePanel.
  • Optionally add a UIButtonKeyTrigger component to the button, and map it to Mouse 0. This will allow the button to listen for mouse clicks even if the click isn't on the button itself.
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

Re: OnContinue once makes all subtitles play superfast

Post by nicmar »

Great! I will try all this and i’m sure it will work. Thank you! :)
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

Re: OnContinue once makes all subtitles play superfast

Post by nicmar »

Hey again!
I tried all this, and it works GREAT... almost.. :)

There is one little issue, and it's when clicking the skip button, it doesn't run my code to animate and hide the current panel.

The skip button runs this code in StandardUIContinueButtonFastForward:

Code: Select all

public virtual void OnFastForward()
{
    if ((typewriterEffect != null) && typewriterEffect.isPlaying)
    {
        typewriterEffect.Stop();
    }
    else
    {
        if (hideContinueButtonOnContinue && continueButton != null) continueButton.gameObject.SetActive(false);
        if (runtimeDialogueUI != null)
        {
            Debug.Log("runtimeDialogueUI = " + runtimeDialogueUI);
            if (continueSubtitlePanel && continueAlertPanel) runtimeDialogueUI.OnContinue();
            else if (continueSubtitlePanel) runtimeDialogueUI.OnContinueConversation();
            else if (continueAlertPanel) runtimeDialogueUI.OnContinueAlert();
        }
    }
}
The problem here seems to be runtimeDialogueUI that refers to whatever I set in the Dialoge System as Dialogue UI. You mentioned that this won't be used. I tried assigning my subtitle and menu panel prefabs to StandardDialogueUI component, but that seemed to show other UI elements that was a child of that component, that I'm not using anymore.

My thoughts now, is if I again should I make a custom version of StandardUIContinueButtonFastForward that calls my method directly instead of using runtimeDialogueUI, in the same way as it controls the typewriter?

Thanks :)
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

Re: OnContinue once makes all subtitles play superfast

Post by nicmar »

Well, I couldn't hold myself so I tried with the subclass and it worked.

I had to change ContinueButton in StandardUIContinueButtonFastForward to protected in the source code, you might want to change that in the source, unless there's a better way of doing what I did.. :)

However, after testing this, it felt a little awkward to press the bubble, so we're switching back to clicking the full screen skip button instead.

So now I'm back to the problem this solved, how do I access the current subtitle panel, to access CustomStandardUISubtitlePanel.OnContinue().

Here's the code I'm using.

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class CustomContinueButton : StandardUIContinueButtonFastForward {
	[SerializeField] private CustomStandardUISubtitlePanel panel;

	public override void OnFastForward() {
		if ((typewriterEffect != null) && typewriterEffect.isPlaying) {
			typewriterEffect.Stop();
		} else {
			if (hideContinueButtonOnContinue && continueButton != null) continueButton.gameObject.SetActive(false);
			if (panel != null) {
				if (continueSubtitlePanel) panel.OnContinue();
			}
		}
	}
}
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnContinue once makes all subtitles play superfast

Post by Tony Li »

Hi,

I'll make continueButton protected in the next release.

If only one conversation is playing at a time, you can continue the conversation like this:

Code: Select all

(DialogueManager.dialogueUI as StandardDialogueUI).OnContinueConversation();
Post Reply