private void Update() { if (Time.time > .3f) { if (results.Count > 0) { int itemsInQueue = results.Count; lock (results) { for (int i = 0; i < itemsInQueue; i++) { PathResult r = results.Dequeue(); r.callback(r.exist, r.vertices); } } } } }