Customize typewriter stop characters?
Customize typewriter stop characters?
Hey, what is the recommended way to change the typewriter custom characters?
I like that there's a break on PERIOD and a short break on COMMA, but I don't like the break when having three periods in a row, like this:
"Where is the smell coming from...?"
Is there a way to ignore ... and only respect . in the end of a sentence or before a space?
Thanks!
I like that there's a break on PERIOD and a short break on COMMA, but I don't like the break when having three periods in a row, like this:
"Where is the smell coming from...?"
Is there a way to ignore ... and only respect . in the end of a sentence or before a space?
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.
Re: Customize typewriter stop characters?
Here are a few options:
1. Use a character that looks like a period but is not.
2. Or, turn off that feature in the typewriter effect. Instead, manually add "\." whenever you want to add a period pause.
3. Or, customize UnityUITypewriterEffect or TextMeshProTypewriterEffect, depending on which type of UI component you're using. I recommend making a subclass or a copy of the script. Don't edit the script directly. Otherwise it will be overwritten when you update the Dialogue System.
1. Use a character that looks like a period but is not.
2. Or, turn off that feature in the typewriter effect. Instead, manually add "\." whenever you want to add a period pause.
3. Or, customize UnityUITypewriterEffect or TextMeshProTypewriterEffect, depending on which type of UI component you're using. I recommend making a subclass or a copy of the script. Don't edit the script directly. Otherwise it will be overwritten when you update the Dialogue System.
Re: Customize typewriter stop characters?
Thanks, I'll make a custom UnityUITypewriterEffect, and make sure to subclass it
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.
Re: Customize typewriter stop characters?
Hey Tony!
I finally got around to subclassing the UnityUITypewriterEffect, but I've having a little trouble figuring out where to inject my code.
This seemed to work, is this how you would do it?
(EDITED, first it didn't work, but I had miss an inspector setting when changing to the custom class)
I finally got around to subclassing the UnityUITypewriterEffect, but I've having a little trouble figuring out where to inject my code.
This seemed to work, is this how you would do it?
Code: Select all
public class CustomUnityUITypewriterEffect : UnityUITypewriterEffect
{
public override IEnumerator Play(int fromIndex = 0)
{
if ((control != null) && (charactersPerSecond > 0)) {
control.text = control.text.Replace("...", "…").Replace("..", "…");
}
typewriterCoroutine = coroutineController.StartCoroutine(base.Play(fromIndex));
yield return null;
}
}
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.
Re: Customize typewriter stop characters?
Oh yeah I had to change this in the original class (out of order):
I think we talked about this in another thread, that some of these should be protected / virtual instead of private / non-virtual
Code: Select all
protected UnityEngine.UI.Text control;
protected Coroutine typewriterCoroutine = null;
protected MonoBehaviour coroutineController = null;
public virtual IEnumerator Play(int fromIndex = 0)
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.
Re: Customize typewriter stop characters?
Hi,
They're all set to protected/virtual in the upcoming version 2.2.2 being released this week. So if you update to 2.2.2 there are no worries about losing your edits to UnityUITypewriterEffect.
They're all set to protected/virtual in the upcoming version 2.2.2 being released this week. So if you update to 2.2.2 there are no worries about losing your edits to UnityUITypewriterEffect.
Re: Customize typewriter stop characters?
Cool thanks! So did you think my solution is a solid one that you would recommend?
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.
Re: Customize typewriter stop characters?
Two thoughts:
1. Make sure your fonts support the elipsis (…) character.
2. Change this line:
to this:
1. Make sure your fonts support the elipsis (…) character.
2. Change this line:
Code: Select all
yield return null;
Code: Select all
yield return typewriterCoroutine;
Re: Customize typewriter stop characters?
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.
Re: Customize typewriter stop characters?
I though of a different thing and I can't figure out how to solve it.
My stop chars are . ? ! and ellipsis. I autoconvert .. and ... into ellipsis using the script in this thread.
But sometimes I want it to say something like this, to make the character seem hesitant:
Are you sure..?
This would give two stops (ellipsis + ?).
Could you think of any way to work around this? Without manually adding break chars, cause that would be too much work..
Thanks!
My stop chars are . ? ! and ellipsis. I autoconvert .. and ... into ellipsis using the script in this thread.
But sometimes I want it to say something like this, to make the character seem hesitant:
Are you sure..?
This would give two stops (ellipsis + ?).
Could you think of any way to work around this? Without manually adding break chars, cause that would be too much work..
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.