diff --git a/Assets/Code/Scripts/Level/SubtitleSequencePlayer.cs b/Assets/Code/Scripts/Level/SubtitleSequencePlayer.cs index 7446f11..4ce8a9b 100644 --- a/Assets/Code/Scripts/Level/SubtitleSequencePlayer.cs +++ b/Assets/Code/Scripts/Level/SubtitleSequencePlayer.cs @@ -144,12 +144,13 @@ public class SubtitleSequencePlayer : MonoBehaviour float typeTime = 0f; int totalChars = line.text.Length; + int visibleChars = 0; if (typewriterCharsPerSecond > 0f) { while (m_currentText.Length < totalChars) { typeTime += Time.deltaTime; - int visibleChars = Mathf.Clamp(Mathf.FloorToInt(typeTime * typewriterCharsPerSecond), 0, totalChars); + visibleChars = Mathf.Clamp(Mathf.FloorToInt(typeTime * typewriterCharsPerSecond), 0, totalChars); m_currentText = line.text.Substring(0, visibleChars); yield return null; }