public void _LogicUpdate(int diff, int unscaledDiff) { if (m_logicUpdating) { return; } m_logicUpdating = true; deltaTime = unscaledDiff; globalDeltaTime = diff; Level.levelTime += unscaledDiff; ++m_frameCount; DispatchEvent(Events.ROOT_ENTER_FRAME, m_globalEvent, false); PhysicsManager.Update(diff); DelayEvents.Update(diff); var size = m_objects.Count; for (var i = 0; i < size;) { var o = m_objects[i]; try { if (!o.destroyed && o.enableUpdate) { o.EnterFrame(); o.Update((int)(diff * o.localTimeScale)); o.QuitFrame(); } if (o.pendingDestroy) { o.Destroy(); } } #if DEVELOPMENT_BUILD || UNITY_EDITOR catch (Exception e) { Logger.LogException(e); } #else catch { } #endif if (o.destroyed) { m_objects.RemoveAt(i); size--; m_rootSize--; if (i <= m_rootIdx) { --m_rootIdx; } } else { ++i; } } DispatchEvent(Events.ROOT_QUIT_FRAME, m_globalEvent, false); onLogicUpdate?.Invoke(diff); m_logicUpdating = false; }