Page 1 of 1
Continue Button Animation
Posted: Mon May 11, 2015 7:22 pm
by BaddyDan
Hello,
I am trying to play a little animated icon, and have it only show at the end of a text segment. So far, it is visible, but it displays throughout the dialogue typing. Is there a way to make it visible only after the typewriter effect has finished? Thanks in advance!
Continue Button Animation
Posted: Tue May 12, 2015 3:24 am
by Tony Li
Hi,
The easiest way is to show the icon after a specified duration. For example, set your Sequence to:
SetActive(MyIcon)@2; required SetActive(MyIcon,false)@{{end}}
This example assumes you're showing the icon by activating a GameObject "MyIcon". At the 2-second mark, it activates MyIcon. At the end value (determined by the length of the dialogue text), it deactivates MyIcon. The "required" keyword ensures that it always deactivates MyIcon even if the player skips ahead.
To show the icon exactly when the typewriter effect ends, use these two steps: First, set the Sequence to:
SetActive(MyIcon)@Message(TypewriterDone); required SetActive(MyIcon,false)@{{end}}
This doesn't activate MyIcon until the sequencer receives a message "TypewriterDone".
Next, duplicate the typewriter effect script. If you're using Unity UI, copy UnityUITypewriterEffect.cs and call it, say, CustomUnityUITypewriterEffect. Make these two changes in the script:
1. Change the class name to match the filename:
public class CustomUnityUITypewriterEffect : MonoBehaviour {...
2. At the end of the effect coroutine, add this line:
Sequencer.Message("TypewriterDone");
Finally, assign this script to your subtitle line instead of the original typewriter script (e.g., UnityUITypewriterEffect).
Continue Button Animation
Posted: Tue May 12, 2015 8:13 am
by BaddyDan
Sir, you are amazing. Thank you!
Continue Button Animation
Posted: Tue May 12, 2015 8:31 am
by Tony Li
Pleasure to help!
Re: Continue Button Animation
Posted: Sat Jan 18, 2020 12:09 pm
by chrislow19
Hi Tony, would it be the same idea for the Textmeshpro typewriter effect?
Re: Continue Button Animation
Posted: Sat Jan 18, 2020 4:01 pm
by Tony Li
Yes, it should use the same basic steps.