Support batchmode with "quit" flag on #29
+22
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
Currently, compiling a game with Apple.Core while in batch mode results in native libraries not being found. That occurs due to the following issues:
1. Creating assets during InitializeOnLoad
According to this Unity issue, assets cannot be created on InitializeOnLoad, because the asset importing is not yet completed at that stage. This was causing a UnityException when building my game due to Apple.Core not being able to load the Default Profile asset, even though it is present in the repository. All the assets creation and retrival were moved to OnPostprocessAllAssets, which, according to the above mentioned Unity issue, is also called after domain reload, but only after all assets have been imported.
2. Using asynchronous coroutines while using
-quit
argumentApplePlugInEnvironment
relies on EditorUpdate to wait for the PackageManager to complete, which will not work on -batchmode -quit. In this case, we have to call EditorUpdate manually