Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(5 edits)

I ran some more tests about Read() (auto read is false, super text mesh is disabled at the beginning):

 public IEnumerator TestCode1()

    {

        superTextMesh.gameObject.SetActive(true);

        superTextMesh.Read();

        Debug.Log(superTextMesh.reading);  //true

        yield return null;

        Debug.Log(superTextMesh.reading);  //false(Read() is blocked there)

        yield return null;

        Debug.Log(superTextMesh.reading);  //false

    }

        public IEnumerator TestCode2()

    {

        superTextMesh.gameObject.SetActive(true);

        yield return null;

        superTextMesh.Read();

        Debug.Log(superTextMesh.reading);  //true

        yield return null;

        Debug.Log(superTextMesh.reading);  //false(Read() is blocked there)

        yield return null;

        Debug.Log(superTextMesh.reading);//false

    }

    public IEnumerator TestCode3() //Read() works in this case

    {

        superTextMesh.gameObject.SetActive(true);

        yield return null;

        yield return null;

        superTextMesh.Read();

        Debug.Log(superTextMesh.reading); //true

        yield return null;

        Debug.Log(superTextMesh.reading); //true(Read() keep working later)

    }

I needed to wait at least two frames after super text mesh was activated to execute Read(), otherwise the code would not work.