Day: July 26, 2015

  • Wait for Real Seconds class using static function in Unity

    Paste this code into a new script called ‘CoroutineUtil’. using UnityEngine; using System.Collections; public static class CoroutineUtil {     public static IEnumerator WaitForRealSeconds(float time)     {         float start = Time.realtimeSinceStartup;         while (Time.realtimeSinceStartup < start + time)         {             yield return null;         }     } } What this class does is expand on the delaying code method by making it work even when the game is paused. The function is made static so that any other script can access…