Skip to content

Small build improvement #3

@EpsilonD3lta

Description

@EpsilonD3lta

This is an insignificant improvement, but code starting on line

[RuntimeInitializeOnLoadMethod]

    [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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions