public void StartAnimatedText()
{
Debug.Log("Animate me");
Time.timeScale = 0;
Camera.main.GetComponent<UnityStandardAssets.ImageEffects.Blur>().enabled = true;
StartCoroutine(AnimateText());
}
public IEnumerator AnimateText()
{
//for (int i = 0; i < (goatText[currentlyDisplayingText].Length + 1); i++)
for (int i = 0; i < (goatText[currentlyDisplayingText].Length) +1; i++)
{
goatTalkingText.text = goatText[currentlyDisplayingText].Substring(0, i);
yield return new WaitForSeconds(Random.Range (0.01f, 0.2f));
//TRY TO ADD AUDIO
}
}
And then I have this function, calling it:
public AutoTyping _scriptAutoType;
goodCubeHitCount++;
if (goodCubeHitCount == 3)
{
//Playerprefs that allows you to reach level 2 and stop this function
PlayerPrefs.SetInt("Level", 2);
Debug.Log("You reached level" + PlayerPrefs.GetInt("Level"));
_scriptAutoType.StartAnimatedText();
this.enabled = false;
}
Well, I get the Log “Animate me” but the coroutine doesn’t start