Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Leaderboard


Popular Content

Showing content with the highest reputation on 01/24/2019 in Posts

  1. 1 point
    Cache your WaitForSeconds() to reduce garbage collection. private var delay = new WaitForSeconds(2f); //Logs the time every 2 seconds. private IEnumerator MyCoroutine() { Debug.Log(Time.time); yield return delay; }
  2. 1 point
    StopCoroutine("CoroutineName") doesn't stop a coroutine on its own. You have to cache it and stop the cached routine. Otherwise you'll just create a copy of the named routine and stop that one. private Coroutine myRoutine; //Start a coroutine and cache it. myRoutine = StartCoroutine("YourCoroutineName"); //Stops the cached coroutine. StopCoroutine(myRoutine);
×
×
  • Create New...