Skip to content
Permalink
Browse files

[GameSystems] Fix removing systems not clearing it from update and draw

  • Loading branch information
Eideren authored and xen2 committed Sep 6, 2019
1 parent f988901 commit 9b4e65fc505856ef0fe79836ead0c68d259d0633
Showing with 16 additions and 4 deletions.
  1. +16 −4 sources/engine/Xenko.Games/GameSystemCollection.cs
@@ -327,8 +327,14 @@ private void GameSystems_ItemRemoved(object sender, TrackingCollectionChangedEve
{
lock (updateableGameSystems)
{
var key = new KeyValuePair<IUpdateable, ProfilingKey>(updateableSystem, null);
updateableGameSystems.Remove(key);
for(int i = 0; i < updateableGameSystems.Count; i++)
{
if(ReferenceEquals(updateableGameSystems[i].Key, updateableSystem))
{
updateableGameSystems.RemoveAt(i);
break;
}
}
}

updateableSystem.UpdateOrderChanged -= UpdateableGameSystem_UpdateOrderChanged;
@@ -339,8 +345,14 @@ private void GameSystems_ItemRemoved(object sender, TrackingCollectionChangedEve
{
lock (drawableGameSystems)
{
var key = new KeyValuePair<IDrawable, ProfilingKey>(drawableSystem, null);
drawableGameSystems.Remove(key);
for (int i = 0; i < drawableGameSystems.Count; i++)
{
if (ReferenceEquals(drawableGameSystems[i].Key, drawableSystem))
{
drawableGameSystems.RemoveAt(i);
break;
}
}
}

drawableSystem.DrawOrderChanged -= DrawableGameSystem_DrawOrderChanged;

0 comments on commit 9b4e65f

Please sign in to comment.
You can’t perform that action at this time.