'Unity 2021.3.0f Builds getting stuck if run build from terminal

I have a custom build pipeline. In Unity 2020 and 2019 version all works fine. After switching to version 2021.3.0f my build started to infinity loading. I use this bash command to start build process /Applications/Unity/Hub/Editor/2021.3.0f1/Unity.app/Contents/MacOS/Unity -batchmode -logfile -buildTarget iOS -executeMethod AutoBuilder.PerformiOSBuild -projectPath "project path" -serial $UNITY_ACCOUNT_SERIAL -username $UNITY_ACCOUNT_USERNAME -password $UNITY_ACCOUNT_PASSWORD

Build script code below

static async void PerformiOSBuild()
    {
        await Task.Delay(15 * 1000);
        PlayerSettings.iOS.sdkVersion = iOSSdkVersion.DeviceSDK;
        EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.iOS, BuildTarget.iOS);
        BuildPipeline.BuildPlayer(EditorBuildSettings.scenes, "Builds/iOS", BuildTarget.iOS, BuildOptions.SymlinkSources);

        EditorApplication.Exit(0); // We cant use "-quit" cli option  with async methods so we quite manually
    }

Last lines of logs

[Licensing::Module] Successfully updated access token: "y4LfqSkH"... (expires: 2022-04-21 17:37:28 GMT)
User "email" logged in successfully
[collab-accelerator] discovery started due to a new cloud project binding
UPID Received 'b6ada6db-b20a-4291-a033-cd2866b3d279'.
[collab-accelerator] Set collab endpoint to https://collab.cloud.unity3d.com (collab-service)

If i run build script manually from unity, it's works fine. I have no idea what goes wrong.



Solution 1:[1]

The solution was to delete await operation from build script. In unknown reason unity 2021.3.0 not support await operation in build method called from batchmode.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ???? ?????