private void DoPostStep() { List <string> deleted = new List <string>(128); SortedDictionary <string, FSGameObject> .Enumerator goIt = gameObjectDictionary.GetEnumerator(); while (goIt.MoveNext()) { goIt.Current.Value.PostStep(); if (goIt.Current.Value.NeedDestroy) { deleted.Add(goIt.Current.Key); goIt.Current.Value.OnDestroy(); } } List <string> .Enumerator deleteIt = deleted.GetEnumerator(); while (deleteIt.MoveNext()) { gameObjectDictionary.Remove(deleteIt.Current); } _frameController.OnPostStep(); }