Jypeli-JYU / Jypeli

A simple educational C# game programming library built on top of Silk.NET.
24 stars 4 forks source link

Fixed bugs in Layers.cs #13

Closed Anttifer closed 4 years ago

Anttifer commented 4 years ago

Fixes #10.

It's worth noting that Game.ResetLayers calls Layer.ApplyChanges, bypassing synchronization. Thus ResetLayers (and by extension, e.g. Game.ClearAll) can't be called while iterating the SynchronousLists of the layers. For example, calling Game.Instance.ClearAll from the Update function of a game object will throw an exception.

On the other hand, Game.ClearGameObjects should work from anywhere with this fix.