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)
{
Time.SetTime(time);
foreach (var gameObject in GameObjects)
gameObject.BehaviourController.Update();
for (int i = 0; i < GameObjects.Count; i++)
GameObjects[i].BehaviourController.Update();
}
public void PreDraw()
{
foreach (var gameObject in GameObjects)
gameObject.BehaviourController.UpdatePreDraw();
for (int i = 0; i < GameObjects.Count; i++)
GameObjects[i].BehaviourController.UpdatePreDraw();
}
/////////////////////////////////////////////////////////////////