public void Update() { if (!generalManager.paused) { Stopwatch stopwatch = Stopwatch.StartNew(); while (updates.Count > 0) { UpdateFromQueue(updates.Dequeue()); if (stopwatch.ElapsedMilliseconds > 25) { UnityEngine.Debug.Log("Break from stopwatch: " + stopwatch.ElapsedMilliseconds); break; } if (generalManager.paused) { break; } } stopwatch.Stop(); } else { if (generalManager.step > 0) { generalManager.DecrementStep(); if (generalManager.step == 0 && updates.Count == 0) { generalManager.Step(1); } if (generalManager.step > 0 && updates.Count > 0) { Queue <Guid> stepQueue = new Queue <Guid>(updates); updates.Clear(); while (stepQueue.Count > 0) { UpdateFromQueue(stepQueue.Dequeue()); } } SetComponentDisplay(); } else if (generalManager.singleStep > 0) { generalManager.DecrementSingleStep(); if (updates.Count > 0) { UpdateFromQueue(updates.Dequeue()); SetComponentDisplay(); } } } }