Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Build error in batch mode (Jenkins)

Discussion in 'Unity Mediation' started by s-saens, Nov 30, 2022.

  1. s-saens

    s-saens

    Joined:
    Aug 14, 2019
    Posts:
    8
    There's an error log about mediation.
    I think that is caused by a problem with Unity Services connection.


    Important jenkins logs below.

    COMMAND LINE ARGUMENTS:
    /Applications/Unity/Hub/Editor/2021.3.14f1/Unity.app/Contents/MacOS/Unity
    -quit
    -batchmode
    -bundleCode
    0000
    -projectPath
    (my project path)
    -executeMethod
    JenkinsBuild.Android
    -logFile
    (hidden)
    -keyaliasPass
    (hidden)
    -keystorePass
    (hidden)
    -username
    songsh5775@gmail.com
    -password
    (hidden)


    Unity Editor version: 2021.3.14f1 (eee1884e7226)
    Branch: 2021.3/staging
    Build type: Release
    Batch mode: YES
    macOS version: Version 13.0.1 (Build 22A400)
    Darwin version: 22.1.0
    Architecture: arm64
    Running under Rosetta: NO
    Available memory: 8192 MB
    User songsh5775@gmail.com logged in successfully
    [LicensingClient] Handshaking with LicensingClient (version: 1.11.0+2b534b4)
    [Licensing::Module] Successfully connected to LicensingClient on channel: "LicenseClient-sanghunsong" (connect: 0.00s, validation: 0.03s, handshake: 0.40s)
    Entitlement-based licensing initiated
    [Licensing::Module] Successfully updated the access token TkRd3IXM9CYevpQYKxTm4fir4ENsULKRLzFQzXyTsJg00df
    [LicensingClient] Licenses updated successfully


    [ServicesCore]: To use Unity's dashboard services, you need to link your Unity project to a project ID. To do this, go to Project Settings to select your organization, select your project and then link a project ID. You also need to make sure your organization has access to the required products. Visit https://dashboard.unity3d.com to sign up.
    UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)
    UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    UnityEngine.Logger:LogWarning (string,object)
    Unity.Services.Core.Internal.CoreLogger:LogWarning (object) (at Library/PackageCache/com.unity.services.core@1.6.0/Runtime/Core.Internal/Logging/CoreLogger.cs:15)
    Unity.Services.Core.Editor.ProjectUnlinkBuildWarning:OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport) (at Library/PackageCache/com.unity.services.core@1.6.0/Editor/Core/Build/ProjectUnlinkBuildWarning.cs:29)
    UnityEditor.Build.BuildPipelineInterfaces/<>c__DisplayClass16_0:<OnBuildPreProcess>b__1 (UnityEditor.Build.IPreprocessBuildWithReport) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:436)
    UnityEditor.Build.BuildPipelineInterfaces:InvokeCallbackInterfacesPair<UnityEditor.Build.IPreprocessBuild, UnityEditor.Build.IPreprocessBuildWithReport> (System.Collections.Generic.List`1<UnityEditor.Build.IPreprocessBuild>,System.Action`1<UnityEditor.Build.IPreprocessBuild>,System.Collections.Generic.List`1<UnityEditor.Build.IPreprocessBuildWithReport>,System.Action`1<UnityEditor.Build.IPreprocessBuildWithReport>,bool) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:402)
    UnityEditor.Build.BuildPipelineInterfaces:OnBuildPreProcess (UnityEditor.Build.Reporting.BuildReport) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:434)
    UnityEditor.BuildPipeline:BuildPlayerInternal (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:449)
    UnityEditor.BuildPipeline:BuildPlayer (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:348)
    UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:322)
    JenkinsBuild:Build (string,string,UnityEditor.BuildTarget,UnityEditor.BuildOptions) (at Assets/Editor/JenkinsBuild.cs:63)
    JenkinsBuild:AndroidWithoutResoulution (bool) (at Assets/Editor/JenkinsBuild.cs:22)
    JenkinsBuild:Android () (at Assets/Editor/JenkinsBuild.cs:16)
    (Filename: Library/PackageCache/com.unity.services.core@1.6.0/Editor/Core/Build/ProjectUnlinkBuildWarning.cs Line: 29)



    Uploading Crash Report
    BuildFailedException: Build canceled
    at Unity.Services.Mediation.Build.Editor.AndroidNativeDependenciesPreBuildCheck.DisplayIssueDetectedDialog (System.Boolean noDialog, System.String issue, Unity.Services.Mediation.Build.Editor.AndroidNativeDependenciesPreBuildCheck+UserAction action) [0x0009a] in /Users/sanghunsong/DEV/Unity/MazeR/Library/PackageCache/com.unity.services.mediation@1.0.4/Editor/Build/PreBuild/AndroidNativeDependenciesPreBuildCheck.cs:144
    at Unity.Services.Mediation.Build.Editor.AndroidNativeDependenciesPreBuildCheck.ValidateDependencies (System.Boolean noDialog) [0x0008f] in /Users/sanghunsong/DEV/Unity/MazeR/Library/PackageCache/com.unity.services.mediation@1.0.4/Editor/Build/PreBuild/AndroidNativeDependenciesPreBuildCheck.cs:92
    at Unity.Services.Mediation.Build.Editor.AndroidNativeDependenciesPreBuildCheck.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) [0x0005e] in /Users/sanghunsong/DEV/Unity/MazeR/Library/PackageCache/com.unity.services.mediation@1.0.4/Editor/Build/PreBuild/AndroidNativeDependenciesPreBuildCheck.cs:48
    at UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass16_0.<OnBuildPreProcess>b__1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) [0x00000] in /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:436
    at UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) [0x000ff] in /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:402
    UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    UnityEngine.Logger:LogException(Exception, Object)
    UnityEngine.Debug:LogException(Exception)
    UnityEditor.Build.BuildPipelineInterfaces:InvokeCallbackInterfacesPair(List`1, Action`1, List`1, Action`1, Boolean) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:415)
    UnityEditor.Build.BuildPipelineInterfaces:OnBuildPreProcess(BuildReport) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:434)
    UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[], Boolean)
    UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:449)
    UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:348)
    UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:322)
    JenkinsBuild:Build(String, String, BuildTarget, BuildOptions) (at Assets/Editor/JenkinsBuild.cs:63)
    JenkinsBuild:AndroidWithoutResoulution(Boolean) (at Assets/Editor/JenkinsBuild.cs:22)
    JenkinsBuild:Android() (at Assets/Editor/JenkinsBuild.cs:16)
    (Filename: Library/PackageCache/com.unity.services.mediation@1.0.4/Editor/Build/PreBuild/AndroidNativeDependenciesPreBuildCheck.cs Line: 144)
     
  2. s-saens

    s-saens

    Joined:
    Aug 14, 2019
    Posts:
    8
    And I cannot understand this situation because the unity account was logged in well as you can see in the log below.
     
  3. jcGrenier

    jcGrenier

    Unity Technologies

    Joined:
    Feb 23, 2021
    Posts:
    145
    Hi @s-saens , this is not about a user being logged into the Editor, but rather your project being linked to the dashboard in the services section of your project settings.

    Hope this helps
     
  4. s-saens

    s-saens

    Joined:
    Aug 14, 2019
    Posts:
    8
    Hi @jcGrenier , thank you for your reply.

    I already linked my project to the dashboard in the editor.
    So if I build my project in the editor, it succeeds, but not in the batch mode.
     
    Last edited: Dec 1, 2022
  5. s-saens

    s-saens

    Joined:
    Aug 14, 2019
    Posts:
    8
    I added this code in the build process script,
    Code (CSharp):
    1. Console.WriteLine("UnityServiceID : " + UnityEditor.CloudProjectSettings.projectId);
    then this log was printed on jenkins

    ...
    UnityServiceID :
    ...

    so I found that the project ID is not assigned.

    I definitely linked my project in the editor.
     
    alytvynenko and ooxcit like this.
  6. jcGrenier

    jcGrenier

    Unity Technologies

    Joined:
    Feb 23, 2021
    Posts:
    145
    Apologies for the delay, I would suggest validating that the projectSettings.asset file has the proper value in
    cloudProjectId:, and that the projectSettings file is available to the tool you use to build in batchmode.
     
  7. unity_k78UnPubQd9P-Q

    unity_k78UnPubQd9P-Q

    Joined:
    Oct 4, 2021
    Posts:
    12
    I am having the same issue, analytics not connecting when building in batchmode. Did you ever resolve this issue?
     
  8. unity_k78UnPubQd9P-Q

    unity_k78UnPubQd9P-Q

    Joined:
    Oct 4, 2021
    Posts:
    12
    We use Jenkins to build using unity command line batchmode nographics, is there any reason that this would reset specifically the CloudProjectSettings.projectID at build time?
     
  9. ooxcit

    ooxcit

    Joined:
    Jul 7, 2021
    Posts:
    25
    I get same error, our project is linked and was working for 2 years now, i tried unlinking and linking, there is project id in ProjectSettings.asset, nothing helps. We use unity cloud build.
     
  10. jcGrenier

    jcGrenier

    Unity Technologies

    Joined:
    Feb 23, 2021
    Posts:
    145
    Hi guys,
    I am no longer part of the Mediation team, so I won't be investigating your issue, but I can offer some advice. Unity's Mediation solution will eventually be decommissioned as Unity has moved towards using LevelPlay.

    I highly recommend you switch to Unity LevelPlay to avoid future issues, as no development is made on Unity Mediation anymore.

    As for specific project linking issues, someone from Unity Game Services may be able to help.

    Sorry I can't offer more assistance, I hope this helped a little.
     
  11. unity_k78UnPubQd9P-Q

    unity_k78UnPubQd9P-Q

    Joined:
    Oct 4, 2021
    Posts:
    12
    One of my coworkers found a UGS.exe that we call to initialize it at runtime via jenkins. Hacky but it works.
     
  12. alytvynenko

    alytvynenko

    Joined:
    Apr 11, 2022
    Posts:
    5
    I have the same issue with my Jenkins builds. Where I can get UGS.exe and how to call it?
     
    skazhan_aio likes this.
  13. bogdanglovo

    bogdanglovo

    Joined:
    Jun 1, 2023
    Posts:
    1
    How do you resolve this problem? Need help
     
    skazhan_aio, alytvynenko and ooxcit like this.
  14. skazhan_aio

    skazhan_aio

    Joined:
    Feb 2, 2023
    Posts:
    1
    The same issue
    Unity game services not activating when running in batch mode - it crashes.
    Could you please provide more information? It`d be very helpful.
     
  15. unity_k78UnPubQd9P-Q

    unity_k78UnPubQd9P-Q

    Joined:
    Oct 4, 2021
    Posts:
    12
    We went to the UGS CLI github releases and downloaded the ugs-windows-x64.exe. In our buildscript we call

    "PATH_TO_EXE\ugs-windows-x64.exe" login --service-key-id <SERVICE_KEY> --secret-key-stdin <SECRET_KEY>


    After this call we make our normal unity nographics batchmode build call.
     
    Last edited: Jun 12, 2023