void UpdateAllSystems() { if (m_systemSortDirty) { SortSystems(); } // Update all unmanaged and managed systems together, in the correct sort order. // The master update list contains indices for both managed and unmanaged systems. // Negative values indicate an index in the unmanaged system list. // Positive values indicate an index in the managed system list. for (int i = 0; i < m_MasterUpdateList.Length; ++i) { try { var index = m_MasterUpdateList[i]; if (!index.IsManaged) { // Update unmanaged (burstable) code. SystemState *sys = World.ResolveSystemState(m_UnmanagedSystemsToUpdate[index.Index]); if (sys != null) { bool updateError = false; updateError = s_UnmanagedUpdateFn((IntPtr)sys, out var details); if (updateError) { #if ENABLE_UNITY_COLLECTIONS_CHECKS var errorString = details.FormatToString(sys->DebugName); Debug.LogError(errorString); #endif } } } else { // Update managed code. var sys = m_systemsToUpdate[index.Index]; sys.Update(); } } catch (Exception e) { Debug.LogException(e); #if UNITY_DOTSRUNTIME // When in a DOTS Runtime build, throw this upstream -- continuing after silently eating an exception // is not what you'll want, except maybe once we have LiveLink. If you're looking at this code // because your LiveLink dots runtime build is exiting when you don't want it to, feel free // to remove this block, or guard it with something to indicate the player is not for live link. throw; #endif } if (World.QuitUpdate) { break; } } World.InternalDestroyPendingUnmanagedSystems(); }