fix: GameManager Instantiation/Deletion during Update causing Array Changed Exception

This commit is contained in:
Syntriax 2024-09-27 18:38:24 +03:00
parent 0f8a7db567
commit c51eda49bf
1 changed files with 4 additions and 4 deletions

View File

@ -89,14 +89,14 @@ public class GameManager : BaseEntity, IGameManager
public void Update(EngineTime time) public void Update(EngineTime time)
{ {
Time.SetTime(time); Time.SetTime(time);
foreach (var gameObject in GameObjects) for (int i = 0; i < GameObjects.Count; i++)
gameObject.BehaviourController.Update(); GameObjects[i].BehaviourController.Update();
} }
public void PreDraw() public void PreDraw()
{ {
foreach (var gameObject in GameObjects) for (int i = 0; i < GameObjects.Count; i++)
gameObject.BehaviourController.UpdatePreDraw(); GameObjects[i].BehaviourController.UpdatePreDraw();
} }
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////