I have a coroutine to fade text in, and I think I just began to understand “yield return null” and how it exits the coroutine but saves the spot and continues the coroutine.
So far it works well, but I want a boolean to be returned when the text is done.
public void ActivateChapterDisplaySequence()
{
Text chapterTitleTextTextCompRef = chapterCanvasRef.transform.Find("Chapter Title Text").gameObject.GetComponent<Text>();
StartCoroutine(textFaderModRef.FadeTextIn(chapterTitleTextTextCompRef)); //This calls the coroutine in the other class.
}
public IEnumerator FadeTextIn(Text givenText)
{
float textAlphaNum = 0;
while (textAlphaNum <= 1.0f)
{
textAlphaNum += Time.deltaTime / 3f;
givenText.color = new Color(1.0f, 1.0f, 1.0f, textAlphaNum);
yield return null;
}
}
I would like to somehow send the signal that the text is done fading with either a bool or some other way.
Does anyone have any ideas?