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
Continue Button Animation
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).
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
Sir, you are amazing. Thank you!
Continue Button Animation
Pleasure to help!
-
- Posts: 34
- Joined: Mon Dec 30, 2019 4:26 pm
Re: Continue Button Animation
Hi Tony, would it be the same idea for the Textmeshpro typewriter effect?
Re: Continue Button Animation
Yes, it should use the same basic steps.