Small build improvement
This is an insignificant improvement, but code starting on line https://github.com/Baste-RainGames/PlayerLoopInterface/blob/141abb7e6d4277107a7d760e71d645fbaeeb5d4f/Runtime/PlayerLoopInterface.cs#L32
[RuntimeInitializeOnLoadMethod]
private static void Initialize() {
// Systems are not automatically removed from the PlayerLoop, so we need to clean up the ones that have been added in play mode, as they'd otherwise
// keep running when outside play mode, and in the next play mode if we don't have assembly reload turned on.
Application.quitting += ClearInsertedSystems;
}
private static void ClearInsertedSystems ()
{
foreach (var playerLoopSystem in insertedSystems)
TryRemoveSystem(playerLoopSystem.type);
insertedSystems.Clear();
Application.quitting -= ClearInsertedSystems;
}
could be probably wrapped in #IF_UNITY_EDITOR, as it's not necessary in build.
Even smaller thing: consider using [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)], probably does not change anything (I tested edge case when I called EditorApplication.ExitPlaymode(); from other [RuntimeInitializeOnLoadMehthod] method and this still got executed), but it exists for purposes like this.
Btw great package, thank you for making it available for everyone.
You're right on both counts!
Clearing the systems in builds is pretty bad, since it (ever so slightly) increases the time it takes to close the game. The ordering of the [RuntimeInitializeOnLoad] call isn't super important since it just hooks up to a message so it doesn't interact with the ordering of other systems, but SubSystemRegistration is more appropriate, yes.
Feel free to send a PR that includes the changes. If not, I'll get around to it eventually.
I created a PR #4. I did not test the code in a build yet. It's a simple change, but I will be making builds in few days so if it doesn't work I'll be back.