/// <summary> /// Invokes the repeating. /// </summary> /// <returns>The repeating.</returns> /// <param name="action">Action.</param> /// <param name="count">Count.</param> /// <param name="delay">Delay.</param> /// <param name="period">Period.</param> public int InvokeRepeating(Action action, int count, float delay, float period) { lock (_lock) { do { NextInvokeId++; } while (InvokingList.ContainsKey(NextInvokeId)); InvokeHandler invokeHandler = new InvokeHandler(action, count, delay, period, NextInvokeId, RemoveInvokeFromDictionary); InvokingList.Add(NextInvokeId, invokeHandler); } // int t1, t2; // ThreadPool.GetMaxThreads(out t1, out t2); // Debug.LogError("Worker Threads: " + t1 + ", Threads: " + t2); return(NextInvokeId); }