As title,
I want to set a button to let player could click it to see the story auto play.
I had no idea about this.is there a function in Dialogue system ?
Or get the typewriter,find the end time to use DialogueManager.conversationView.OnConversationContinueAll();?
But I did not find the finished function..
How to auto play the conversation skip the contunure button?
Re: How to auto play the conversation skip the contunure button?
Hi,
If you want to advance each subtitle after the typewriter effect has finished -- but only if the player has clicked the auto-play button -- add a small script to the dialogue UI like this:
Then inspect the subtitle text's typewriter effect. Configure the OnEnd() UnityEvent to call HandleAutoPlay.OnTypewriterFinished.
To turn on autoplay, set the script's autoplay variable true.
If you want to advance each subtitle after the typewriter effect has finished -- but only if the player has clicked the auto-play button -- add a small script to the dialogue UI like this:
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class HandleAutoPlay : MonoBehaviour
{
public bool autoplay;
public void OnTypewriterFinished()
{
if (autoplay) GetComponent<StandardDialogueUI>().OnContinueConversation();
}
}
To turn on autoplay, set the script's autoplay variable true.
Re: How to auto play the conversation skip the contunure button?
Thank you,Tony.
I just want test what I thought if it is right.I write this code in Start After some seconds:
But It seems could not run,the Unity always Crash.Could you point out what's wrong with this code?
I just want test what I thought if it is right.I write this code in Start After some seconds:
Code: Select all
UnityAction endAction=()=>
{
[the Standard UI GameObject].GetComponent<StandardDialogueUI>().OnContinueConversation();
};
[The Typewriter GameObject].GetComponent<TextMeshProTypewriterEffect>().onEnd.AddListener(endAction);
Re: How to auto play the conversation skip the contunure button?
I don't see anything immediately wrong. Try tracing through with the debugger or adding Debug.Log lines. If you can't find the issue, please feel free to send a reproduction project to tony (at) pixelcrushers.com.
Re: How to auto play the conversation skip the contunure button?
I had wroten Debug.Log.
It would run
when the dialogue system is opened and typewriter finished.
So I tried to let the fisrt time skip,but It would be crash when I used GetComponent<StandardDialogueUI>().OnContinueConversation();.
I run it in another computer,sometime it would not be crash,but it would be this error:
Couldn't extract exception string from exception of type StackOverflowException (another exception of class 'StackOverflowException' was thrown while processing the stack trace)
It would run
when the dialogue system is opened and typewriter finished.
So I tried to let the fisrt time skip,but It would be crash when I used GetComponent<StandardDialogueUI>().OnContinueConversation();.
I run it in another computer,sometime it would not be crash,but it would be this error:
Couldn't extract exception string from exception of type StackOverflowException (another exception of class 'StackOverflowException' was thrown while processing the stack trace)
Re: How to auto play the conversation skip the contunure button?
Finnally I found my solution,just let OnContinueConversation() execute after 0.5 second.It will be ok.
Now,I Have another question is I want to use "ctrl" key to let the connversation speed up.when I enter the "ctrl",I use this code:
[TextMeshProTypewriter gameObject].GetComponent<TextMeshProTypewriterEffect>().charactersPerSecond =seedUp;
DialogueManager.displaySettings.subtitleSettings.subtitleCharsPerSecond = seedup;
And when exit the keyboard "ctrl" I used:
[TextMeshProTypewriter gameObject].GetComponent<TextMeshProTypewriterEffect>().charactersPerSecond =origenSpeed;
DialogueManager.displaySettings.subtitleSettings.subtitleCharsPerSecond = origenSpeed;
if I exit the ctrl and the typewriter has not finished,the words typing will stop.And I had no idea to solve this,Is there a better way to let all conversation speed up with enter "ctrl",release "ctrl" will recover the speed?
P.S I also set DialogueManager.displaySettings.subtitleSettings.subtitleCharsPerSecond,just becaule I want the{{end}} in sequence is right second,but it seems not really work.
Now,I Have another question is I want to use "ctrl" key to let the connversation speed up.when I enter the "ctrl",I use this code:
[TextMeshProTypewriter gameObject].GetComponent<TextMeshProTypewriterEffect>().charactersPerSecond =seedUp;
DialogueManager.displaySettings.subtitleSettings.subtitleCharsPerSecond = seedup;
And when exit the keyboard "ctrl" I used:
[TextMeshProTypewriter gameObject].GetComponent<TextMeshProTypewriterEffect>().charactersPerSecond =origenSpeed;
DialogueManager.displaySettings.subtitleSettings.subtitleCharsPerSecond = origenSpeed;
if I exit the ctrl and the typewriter has not finished,the words typing will stop.And I had no idea to solve this,Is there a better way to let all conversation speed up with enter "ctrl",release "ctrl" will recover the speed?
P.S I also set DialogueManager.displaySettings.subtitleSettings.subtitleCharsPerSecond,just becaule I want the{{end}} in sequence is right second,but it seems not really work.