Hi Tony,
I am using Dialogue System and Text Animator. I am using the Accumulate Text option.
I'm having a couple of problems:
1. The Text Animator is replaying the entire conversation each time a Player makes a choice. It doesn't seem to recognise that it should only play the new text.
2. The screen isn't scrolling correctly. It allows the writing to disappear off the bottom and then jumps to catch up (scrolling the entire screen rather than scrolling as the text appears). The screen also isn't scrolling to show the buttons if the conversation text hits the bottom of the screen.
Can you help please?
Thanks
Pete
Integration with Text Animator
Re: Integration with Text Animator
Hi Pete,
When using Text Animator, the Dialogue System hands off typewriting responsibilities to Text Animator. I'll check today if there's a way to get Text Animator to start typing at the new text, and to get it to handle scrolling.
When using Text Animator, the Dialogue System hands off typewriting responsibilities to Text Animator. I'll check today if there's a way to get Text Animator to start typing at the new text, and to get it to handle scrolling.
Re: Integration with Text Animator
Hi,
I'll include this script with 2.2.17's updated TextAnimator Support package:
To automatically scroll, try configuring the Text Animator Player component's OnCharacterVisible() UnityEvent to call the ScrollRect's UIScrollbarEnabler.CheckScrollbarWithResetValue.
I'll include this script with 2.2.17's updated TextAnimator Support package:
TextAnimatorSubtitlePanel.cs
Code: Select all
// Copyright (c) Pixel Crushers. All rights reserved.
using System.Collections;
namespace PixelCrushers.DialogueSystem
{
/// <summary>
/// Use this subclass of StandardUISubtitlePanel if your subtitle panel uses
/// Text Animator and Accumulate Text is ticked.
/// </summary>
public class TextAnimatorSubtitlePanel : StandardUISubtitlePanel
{
public override void Open()
{
base.Open();
ClearText();
}
public override void SetContent(Subtitle subtitle)
{
if (accumulateText)
{
var previousChars = subtitleText.textMeshProUGUI.textInfo.characterCount;
StartCoroutine(SkipTypewriterAhead(previousChars));
}
base.SetContent(subtitle);
}
protected IEnumerator SkipTypewriterAhead(int numChars)
{
var textAnimator = subtitleText.gameObject.GetComponent<Febucci.UI.TextAnimator>();
if (textAnimator != null)
{
yield return null;
for (int i = 0; i < numChars; i++)
{
textAnimator.IncreaseVisibleChars();
}
}
}
}
}
Re: Integration with Text Animator
Thanks Tony
Great support as always.
Pete
Great support as always.
Pete
Re: Integration with Text Animator
Glad to help!
Re: Integration with Text Animator
Hi Tony,
I've implemented the changes that you suggested using the script you provided.
The "restart from the beginning" issue has been solved - but the text accumulation is not working. I have "accumulate text" checked.
How to replicate...
Dialogue A: "You see Fred."
Player Response 1 "Talk to Fred"
Dialogue B: "Fred is pleased to see you."
It plays Dialogue A fine.
When I make the Player Response:
I notice in the script that there is code inside Open() that says "ClearText()". It looks like this is clearing the Subtitle text.
I can comment this line out and the text will accumulate - but I think this hides rather than fixes the problem and I presume it will cause problems after playing multiple conversations. It also introduces another issue. The text disappears and then reappears. So I suspect that one of the key objects (the Subtitle Panel?) is being closed and reopened for some reason - and that triggers the clear text(). I couldn't find a setting that controlled this though.
Could you have a look please?
I'm also going to try to pre-empt what I suspect will be the next problem for me. I'd like to implement the functions you have provided previously to speed up the typewriter effect when the continue button is pressed (speed up rather than just jumping to the end). If the typewriter control has been handed off to Text Animator, would you be able to provide an update to the previous "ContinueButtonSpeedUp" script so that the typewriting effect can still be sped up when using the Text Animator? Thank you.
Thanks
Pete
I've implemented the changes that you suggested using the script you provided.
The "restart from the beginning" issue has been solved - but the text accumulation is not working. I have "accumulate text" checked.
How to replicate...
Dialogue A: "You see Fred."
Player Response 1 "Talk to Fred"
Dialogue B: "Fred is pleased to see you."
It plays Dialogue A fine.
When I make the Player Response:
- It clears the screen
- it shows the response (which I want it to do, so that's good)
- it clears the screen
- it shows Dialogue B.
I notice in the script that there is code inside Open() that says "ClearText()". It looks like this is clearing the Subtitle text.
I can comment this line out and the text will accumulate - but I think this hides rather than fixes the problem and I presume it will cause problems after playing multiple conversations. It also introduces another issue. The text disappears and then reappears. So I suspect that one of the key objects (the Subtitle Panel?) is being closed and reopened for some reason - and that triggers the clear text(). I couldn't find a setting that controlled this though.
Could you have a look please?
I'm also going to try to pre-empt what I suspect will be the next problem for me. I'd like to implement the functions you have provided previously to speed up the typewriter effect when the continue button is pressed (speed up rather than just jumping to the end). If the typewriter control has been handed off to Text Animator, would you be able to provide an update to the previous "ContinueButtonSpeedUp" script so that the typewriting effect can still be sped up when using the Text Animator? Thank you.
Thanks
Pete
Re: Integration with Text Animator
Hi,
Clearing the text in Open or OnConversationStart shouldn't affect the typewriter during the conversation, only when the conversation first starts. Make sure your subtitle panel's Visibility is set to Always From Start or Always Once Shown.
I'm tied up finishing version 2.2.17, so I'm afraid writing a speed up script for Text Animator will need to be up to you.
Clearing the text in Open or OnConversationStart shouldn't affect the typewriter during the conversation, only when the conversation first starts. Make sure your subtitle panel's Visibility is set to Always From Start or Always Once Shown.
I'm tied up finishing version 2.2.17, so I'm afraid writing a speed up script for Text Animator will need to be up to you.