feat: update manager now calls last frames listeners on process exit as well

This commit is contained in:
Syntriax 2025-08-05 20:57:03 +03:00
parent b04e0f81cd
commit d78c42a653

View File

@ -75,9 +75,16 @@ public class UpdateManager : Behaviour
args.BehaviourRemoved.LastActiveFrame();
}
private void CallLastFramesBeforeExit(object? sender, System.EventArgs e)
{
for (int i = lastFrameUpdates.Count - 1; i >= 0; i--)
lastFrameUpdates[i].LastActiveFrame();
}
public UpdateManager()
{
firstFrameUpdates.OnCollected.AddListener(OnFirstFrameCollected);
lastFrameUpdates.OnRemoved.AddListener(OnLastFrameRemoved);
System.AppDomain.CurrentDomain.ProcessExit += CallLastFramesBeforeExit;
}
}