unity-builder icon indicating copy to clipboard operation
unity-builder copied to clipboard

BuildTarget is ignored on linux

Open sebas77 opened this issue 3 months ago • 21 comments

Bug description

BuildTarget is ignored on linux building machine, The editor will start in Linux standalone no matter what How to reproduce

on Windows this script

  - name: Build Android Package
    id: build-android-package
    if: ${{ github.event.inputs.debug == 'false' || github.event_name != 'workflow_dispatch' }}
    uses: game-ci/[email protected]
    env:
      BUILD_APP_BUNDLE: ${{ env.BUILD_TYPE == 'aab' && 'true' || 'false' }}
    with:
      targetPlatform: Android
      customImage: ${{ env.DOCKER_IMAGE }}
      buildMethod: ${{ env.buildMethod }}
      projectPath: ${{ env.WORKSPACE_PATH }}/lm_client # Updated project path
      version: "1.0.0"
      versioning: 'Custom'
      customParameters: -nographics -silent-crashes -batchmode -quit -buildTarget Android -aabbundleversion ${{ needs.validate-build.outputs.BUNDLE_VERSION }} -keystorepass ${{ steps.keystore-params.outputs.KEYSTORE_PASS }} -keyalias ${{ steps.keystore-params.outputs.KEY_ALIAS }} -keypass ${{ steps.keystore-params.outputs.KEY_ALIAS_PASS }} -keystorebase64 ${{secrets.KEYSTORE_BASE64}} -isBM yes -adddefines ${{ github.event.inputs.extra-defines }} 

started unity in Android mode, but on linux, regardless what I use, the editor always start in linux standalone mode.

I tried using 4.5.0 and 4.6.0 with the new build profile option and no change. The command line shows it should run in android mode

COMMAND LINE ARGUMENTS: /opt/unity/Editor/Unity -batchmode -logfile /dev/stdout -quit -customBuildName Android -projectPath /github/workspace/test-android/lm_client -customBuildTarget Android -customBuildPath /github/workspace/build/Android/Android.apk -customBuildProfile Assets/Settings/Android-Profiling.asset -activeBuildProfile Assets/Settings/Android-Profiling.asset -executeMethod Lm.Editor.BuildSupport.BuildAndroidApk -buildVersion 1.0.0 -androidVersionCode 1000000 -androidKeystoreName -androidKeystorePass -androidKeyaliasName -androidKeyaliasPass -androidTargetSdkVersion -androidExportType androidPackage -androidSymbolType none -nographics -silent-crashes -batchmode -quit -aabbundleversion 410 -keystorepass -keyalias -keypass -keystorebase64 *** -isBM yes -adddefines Successfully changed project path to: /github/workspace/test-android/lm_client

but there is nothing to do, it will always start without the UNITY_ANDROID define (and with the UNITY_STANDALONE_LINUX define enabled). Again this worked on windows, but is not working on linux no matter what. the image I use are:

unityci/editor:windows-6000.0.26f1-android-3.1 unityci/editor:ubuntu-6000.2.6f1-android-3.1.0

so as you can see the unity version is a factor too.

sebas77 avatar Sep 30 '25 20:09 sebas77

This issue might be specific to the new editor not picking up the flags or something. Have you tried earlier version of the ubuntu-6000 image?

webbertakken avatar Sep 30 '25 22:09 webbertakken

I tried previously with 6000.2.4 And was the same

sebas77 avatar Sep 30 '25 22:09 sebas77

For Windows you're using .0.26f1, have you tried the same version for ubuntu?

Would be nice if we could narrow it down to all 6000.x versions for Linux or not.

As far as I know this always worked pre 6000.x, as there are no bug reports for it.

webbertakken avatar Sep 30 '25 22:09 webbertakken

I tested exactly the same command line (well not exactly, I removed the arguments that are not part of the unity command line, not sure why they are there in the first place), locally on windows AND wsl2 with unity 6000.2.6f1 and they both work as expected. Of course the variables left at this point are the docker image and your action. There might be another variable, which is the fact I am using for the first time the Unity License Server, I would be surprised if it causes the problem, but one never knows.

command line tested:

/home/sebas77/Unity/Hub/Editor/6000.2.6f1/Editor/Unity -batchmode -quit -projectPath ./lm_client/lm_client/ -customBuildTarget Android -customBuildProfile Assets/Settings/Android-Profiling.asset -activeBuildProfile Assets/Settings/Android-Profiling.asset -executeMethod Lm.Editor.BuildSupport.BuildAndroidApk -nographics -aabbundleversion 410 -isBM yes -logFile -

(note that -customBuildProfile is not part of unity command line either but I forgot to remove that one)

At the moment I will be forced to use a workaround, changing platform on init, but this is suboptimal since unity would import the assets for a different platform initially.

sebas77 avatar Oct 01 '25 12:10 sebas77

Accepting fix PRs if anyone knows what's going on here.

webbertakken avatar Oct 01 '25 19:10 webbertakken

I am investigating if the problem was due to the license server, i will keep you updated

sebas77 avatar Oct 01 '25 19:10 sebas77

even stranger the log acknowledge that Android is the target

[Package Manager] Connected to IPC stream "Upm-205" after 0.8 seconds. Library Redirect Path: Library/ Rebuilding Library because the asset database could not be found! [Physics::Module] Selected backend. [Physics::Module] Name: PhysX [Physics::Module] Id: 0xf2b8ea05 [Physics::Module] SDK Version: 4.1.2 [Physics::Module] Integration Version: 1.0.0 [Physics::Module] Threading Mode: Multi-Threaded PlayerPrefs - Creating folder: /home/UNKNOWN/.config/unity3d/CoreLoop PlayerPrefs - Creating folder: /home/UNKNOWN/.config/unity3d/CoreLoop/World Eternal Unable to load player prefs [Licensing::Client] Error: Code 404 while processing request (status: Found 0 entitlement groups and 0 free entitlements matching requested entitlement ids) [Licensing::Module] Error: 'com.unity.editor.headless' was not found. Targeting platform: Android Refreshing native plugins compatible for Editor in 0.00 ms, found 0 plugins. Preloading 0 native plugins for Editor in 0.00 ms. Initialize engine version: 6000.2.6f1 (cc51a95c0300) [Subsystems] Discovering subsystems at path /opt/unity/Editor/Data/Resources/UnitySubsystems [Subsystems] Discovering subsystems at path /github/workspace/test-android/lm_client/Assets Forcing GfxDevice: Null GfxDevice: creating device client; kGfxThreadingModeNonThreaded NullGfxDevice: Version: NULL 1.0 [1.0] Renderer: Null Device Vendor: Unity Technologies

but then UNITY_ANDROID is not defined

sebas77 avatar Oct 01 '25 21:10 sebas77

right after the defines do not shot UNITY_ANDROID

Contents of Library/Bee/artifacts/2400b0aE.dag/Assembly-CSharp-Editor.rsp

-target:library -out:"Library/Bee/artifacts/2400b0aE.dag/Assembly-CSharp-Editor.dll" -refout:"Library/Bee/artifacts/2400b0aE.dag/Assembly-CSharp-Editor.ref.dll" -define:UNITY_6000_2_6 -define:UNITY_6000_2 -define:UNITY_6000 -define:UNITY_5_3_OR_NEWER -define:UNITY_5_4_OR_NEWER -define:UNITY_5_5_OR_NEWER -define:UNITY_5_6_OR_NEWER -define:UNITY_2017_1_OR_NEWER -define:UNITY_2017_2_OR_NEWER -define:UNITY_2017_3_OR_NEWER -define:UNITY_2017_4_OR_NEWER -define:UNITY_2018_1_OR_NEWER -define:UNITY_2018_2_OR_NEWER -define:UNITY_2018_3_OR_NEWER -define:UNITY_2018_4_OR_NEWER -define:UNITY_2019_1_OR_NEWER -define:UNITY_2019_2_OR_NEWER -define:UNITY_2019_3_OR_NEWER -define:UNITY_2019_4_OR_NEWER -define:UNITY_2020_1_OR_NEWER -define:UNITY_2020_2_OR_NEWER -define:UNITY_2020_3_OR_NEWER -define:UNITY_2021_1_OR_NEWER -define:UNITY_2021_2_OR_NEWER -define:UNITY_2021_3_OR_NEWER -define:UNITY_2022_1_OR_NEWER -define:UNITY_2022_2_OR_NEWER -define:UNITY_2022_3_OR_NEWER -define:UNITY_2023_1_OR_NEWER -define:UNITY_2023_2_OR_NEWER -define:UNITY_2023_3_OR_NEWER -define:UNITY_6000_0_OR_NEWER -define:UNITY_6000_1_OR_NEWER -define:UNITY_6000_2_OR_NEWER -define:PLATFORM_ARCH_64 -define:UNITY_64 -define:UNITY_INCLUDE_TESTS -define:ENABLE_AUDIO -define:ENABLE_CACHING -define:ENABLE_CLOTH -define:ENABLE_MICROPHONE -define:ENABLE_MULTIPLE_DISPLAYS -define:ENABLE_PHYSICS -define:ENABLE_TEXTURE_STREAMING -define:ENABLE_VIRTUALTEXTURING -define:ENABLE_LZMA -define:ENABLE_UNITYEVENTS -define:ENABLE_VR -define:ENABLE_WEBCAM -define:ENABLE_UNITYWEBREQUEST -define:ENABLE_WWW -define:ENABLE_CLOUD_SERVICES -define:ENABLE_CLOUD_SERVICES_ADS -define:ENABLE_CLOUD_SERVICES_USE_WEBREQUEST -define:ENABLE_UNITY_CONSENT -define:ENABLE_UNITY_CLOUD_IDENTIFIERS -define:ENABLE_CLOUD_SERVICES_CRASH_REPORTING -define:ENABLE_CLOUD_SERVICES_PURCHASING -define:ENABLE_CLOUD_SERVICES_ANALYTICS -define:ENABLE_CLOUD_SERVICES_BUILD -define:ENABLE_EDITOR_GAME_SERVICES -define:ENABLE_UNITY_GAME_SERVICES_ANALYTICS_SUPPORT -define:ENABLE_CLOUD_LICENSE -define:ENABLE_EDITOR_HUB_LICENSE -define:ENABLE_WEBSOCKET_CLIENT -define:ENABLE_GENERATE_NATIVE_PLUGINS_FOR_ASSEMBLIES_API -define:ENABLE_DIRECTOR_AUDIO -define:ENABLE_DIRECTOR_TEXTURE -define:ENABLE_MANAGED_JOBS -define:ENABLE_MANAGED_TRANSFORM_JOBS -define:ENABLE_MANAGED_ANIMATION_JOBS -define:ENABLE_MANAGED_AUDIO_JOBS -define:ENABLE_MANAGED_UNITYTLS -define:INCLUDE_DYNAMIC_GI -define:ENABLE_SCRIPTING_GC_WBARRIERS -define:PLATFORM_SUPPORTS_MONO -define:RENDER_SOFTWARE_CURSOR -define:ENABLE_MARSHALLING_TESTS -define:ENABLE_VIDEO -define:ENABLE_NAVIGATION_OFFMESHLINK_TO_NAVMESHLINK -define:ENABLE_ACCELERATOR_CLIENT_DEBUGGING -define:TEXTCORE_1_0_OR_NEWER -define:EDITOR_ONLY_NAVMESH_BUILDER_DEPRECATED -define:PLATFORM_STANDALONE_LINUX -define:PLATFORM_STANDALONE -define:UNITY_STANDALONE_LINUX -define:UNITY_STANDALONE -define:UNITY_STANDALONE_LINUX_API -define:ENABLE_RUNTIME_GI -define:ENABLE_MOVIES -define:ENABLE_NETWORK -define:ENABLE_CRUNCH_TEXTURE_COMPRESSION -define:ENABLE_CLUSTER_SYNC -define:ENABLE_CLUSTERINPUT -define:ENABLE_SPATIALTRACKING -define:ENABLE_MODULAR_UNITYENGINE_ASSEMBLIES -define:PLATFORM_SUPPORTS_SPLIT_GRAPHICS_JOBS -define:PLATFORM_USES_EXPLICIT_MEMORY_MANAGER_INITIALIZER -define:ENABLE_MONO -define:NET_4_6 -define:NET_UNITY_4_8 -define:ENABLE_PROFILER -define:DEBUG -define:TRACE -define:UNITY_ASSERTIONS -define:UNITY_EDITOR -define:UNITY_EDITOR_64 -define:UNITY_EDITOR_LINUX -define:ENABLE_UNITY_COLLECTIONS_CHECKS -define:ENABLE_BURST_AOT -define:UNITY_TEAM_LICENSE -define:ENABLE_CUSTOM_RENDER_TEXTURE -define:ENABLE_DIRECTOR -define:ENABLE_LOCALIZATION -define:ENABLE_SPRITES -define:ENABLE_TERRAIN -define:ENABLE_TILEMAP -define:ENABLE_TIMELINE -define:ENABLE_INPUT_SYSTEM -define:TEXTCORE_FONT_ENGINE_1_5_OR_NEWER -define:TEXTCORE_TEXT_ENGINE_1_5_OR_NEWER -define:UNITASK_DOTWEEN_SUPPORT -define:USING_URP -define:ASTAR_NO_ZIP -define:ASTAR_GRID_NO_CUSTOM_CONNECTIONS -define:ASTAR_LEVELGRIDNODE_FEW_LAYERS -define:ASTAR_NO_PENALTY -define:ASTAR_NO_GUI -define:IB_UNITY_CULL_FOR_SINGLE_INSTANCES -define:USC_UNITY_PIPELINE_URP -define:LEVELPLAY_DEPENDENCIES_INSTALLED -define:RUN_CULL_ON_MAIN_THREAD -define:ENABLE_BAKERY -define:EMBEDDED_REALM -define:STEAMWORKS_NET -define:CSHARP_7_OR_LATER -define:CSHARP_7_3_OR_NEWER -define:UNITY_EDITOR_ONLY_COMPILATION

sebas77 avatar Oct 01 '25 22:10 sebas77

the issue was indeed related to licensing...absolutely incredible

I will discuss this with my Unity representative .

I had to add this to force untiy using the right toolset for the license server

  - name: Unity client config
    run: |
      sudo mkdir -p /usr/share/unity3d/config
      sudo tee /usr/share/unity3d/config/services-config.json >/dev/null <<'JSON'
      {
        "licensingServiceBaseUrl": "$UNITY_LICENSING_SERVER",
        "enableEntitlementLicensing": true,
        "clientConnectTimeoutSec": 60,
        "clientHandshakeTimeoutSec": 30,
        "toolset": "LicenseServer_1375782320542_3"
      }
      JSON

don't ask me why, chatgpt figured it out from the logs!!! However I thought game-ci would take care of this, although the important bit was the toolset part... ...there could be still a game-ci bug though. I definitively setup the default toolset in my server, so I wonder if game-ci is just not creating the config file correctly.

sebas77 avatar Oct 01 '25 23:10 sebas77

Completely possible!

We rely on community contributions for licensing server, as none of the maintainers has access to even the documentation for it.

webbertakken avatar Oct 02 '25 10:10 webbertakken

The documentation online should be enough to understand how to create a client config file for the floating license

https://docs.unity.com/licensing/manual/ClientConfig

Best Regards,

Sebastiano Mandalà

On Thu, Oct 2, 2025, 11:28 Webber Takken @.***> wrote:

webbertakken left a comment (game-ci/unity-builder#739) https://github.com/game-ci/unity-builder/issues/739#issuecomment-3360377800

Completely possible!

We rely on community contributions for licensing server, as none of the maintainers has access to even the documentation for it.

— Reply to this email directly, view it on GitHub https://github.com/game-ci/unity-builder/issues/739#issuecomment-3360377800, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHGZYZKH56K2ZAU2RYDBOT3VT44JAVCNFSM6AAAAACH6BRQVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGNRQGM3TOOBQGA . You are receiving this because you modified the open/close state.Message ID: @.***>

sebas77 avatar Oct 02 '25 10:10 sebas77

Even then, we have no way to understand the quirks intrinsically and we have no way to test it. So having the docs doesn't change the fact that we're relying on community contributions for it.

webbertakken avatar Oct 02 '25 10:10 webbertakken

Ok.

What happened to me might be allegedly (because I won't have the time to investigate any further) a mix of the server not having a default toolset and / or the client asking for a toolkit that didn't exist (from the log com.unity.editor.headless)

Best Regards,

Sebastiano Mandalà

On Thu, Oct 2, 2025, 11:58 Webber Takken @.***> wrote:

webbertakken left a comment (game-ci/unity-builder#739) https://github.com/game-ci/unity-builder/issues/739#issuecomment-3360541075

Even then, we have no way to understand the quirks intrinsically and we have no way to test it. So having the docs doesn't change the fact that we're relying on community contributions for it.

— Reply to this email directly, view it on GitHub https://github.com/game-ci/unity-builder/issues/739#issuecomment-3360541075, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHGZY4OMC2JF4R47NQSHC33VUALVAVCNFSM6AAAAACH6BRQVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGNRQGU2DCMBXGU . You are receiving this because you modified the open/close state.Message ID: @.***>

sebas77 avatar Oct 02 '25 11:10 sebas77

hmm I have notice my solution is not reliable...game-ci generates this config automatically

[UnityConnectServicesConfig] Service configuration: "servicesConfigBaseUrl": "", "disableServicesWindow": false, "disableUserLogin": false, "entitlementCacheTimeoutInSeconds": 60, "clientConnectTimeoutSec": 5, "clientHandshakeTimeoutSec": 10, "clientResolveEntitlementsTimeoutSec": 30, "clientUpdateLicenseTimeoutSec": 30, "licensingServiceBaseUrl": "http://3.224.150.72:8080/", "enableProxyAutoconfig": "false"

but it seems that my way to override it is not reliable...how can I modify this behaviour?

I suppose the only good way is if you provide a new field so we can override the "toolset" parameter.

I have no clue why all of a sudden is not working again, is very frustrating, but somehow my step is being overriden again by yours

      - name: Unity client config
        run: |
          sudo mkdir -p /usr/share/unity3d/config
          sudo tee /usr/share/unity3d/config/services-config.json >/dev/null <<'JSON'
          {
            "licensingServiceBaseUrl": "$UNITY_LICENSING_SERVER",
            "enableEntitlementLicensing": true,
            "clientConnectTimeoutSec": 60,
            "clientHandshakeTimeoutSec": 30,
            "toolset": "LicenseServer_1375782320542_3"
          }
          JSON

      - name: Build Android Package
        id: build-android-package

note that I have just confirmed that server side the default tool set is correctly set

"defaultToolset": "LicenseServer_1375782320542_3"

so somehow is the config generated by game-ci to be wrong

sebas77 avatar Oct 02 '25 12:10 sebas77

it is definitively possible that it was not working because I was using runAsHostUser true

edit: I can almost definitively say that the problem was caused by it and using the 1001 user (whatever it is, I am not linux expert), which caused the license client request to malfunction. I am not using any config override, which was ineffective anwyay because I didnt'realise that the usr folder is not mounted, and now it works

sebas77 avatar Oct 02 '25 13:10 sebas77

what's needed is an option to be able to specify the unity license server toolset too. I am not able to understand why it doesn't recognise it as a default toolset although it is set as such. I know that specifying directly the toolset will fix it, but I cannot find a reliable way to inject the information in the config used by the docker image. I am now falling back to local unity installation but even that is extremely painful.

sebas77 avatar Oct 03 '25 13:10 sebas77

Hi I think maybe we have the same issue - our license server seems to be using the floating licenses for devs in CI, and not the far more numerous build server licenses. Is there any way to specify what GameCI puts into "toolset" in services-config.json ?

ChristianTellefsen avatar Oct 29 '25 09:10 ChristianTellefsen

I didn't find a way and requested the feature then I moved away from game ci and docker.

Mind that I have also realized that the Linux version of unity randomly fails to acquire the license even with the correct toolset. I didn't see the issue on Windows

Best Regards,

Sebastiano Mandalà

On Wed, 29 Oct 2025, 09:53 Christian Tellefsen, @.***> wrote:

ChristianTellefsen left a comment (game-ci/unity-builder#739) https://github.com/game-ci/unity-builder/issues/739#issuecomment-3460651837

Hi I think maybe we have the same issue - our license server seems to be using the floating licenses for devs in CI, and not the far molre numerous build server licenses. Is there any way to specify what GameCI puts into "toolset" in services-config.json ?

— Reply to this email directly, view it on GitHub https://github.com/game-ci/unity-builder/issues/739#issuecomment-3460651837, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHGZY3SFRQTW3DCLIZSDTL32CFBLAVCNFSM6AAAAACH6BRQVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTINRQGY2TCOBTG4 . You are receiving this because you modified the open/close state.Message ID: @.***>

sebas77 avatar Oct 29 '25 10:10 sebas77

We're trying a workaround now by setting up a build server that only provides the build server licenses, and not the floating developer licenses.

ChristianTellefsen avatar Oct 29 '25 10:10 ChristianTellefsen

OK, that workaround seems to work for us (well, so far). When we set up a Unity license server that only contains the (many) build server licenses, and not the (few) floating developer licenses, then the license activation grabs the correct build server license and we don't get the licensing issues. But it would still be nice to be able to specify in the action which license pool to grab from.

ChristianTellefsen avatar Oct 29 '25 13:10 ChristianTellefsen

ok nice, i think we got only build server license, but it's all so confusing...who knows

On Wed, 29 Oct 2025 at 13:54, Christian Tellefsen @.***> wrote:

ChristianTellefsen left a comment (game-ci/unity-builder#739) https://github.com/game-ci/unity-builder/issues/739#issuecomment-3461659821

OK, that workaround seems to work for us (well, so far). When we set up a Unity license server that only contains the (many) build server licenses, and not the (few) floating developer licenses, then the license activation grabs the correct build server license and we don't get the licensing issues. But it would still be nice to be able to specify in the action which license pool to grab from.

— Reply to this email directly, view it on GitHub https://github.com/game-ci/unity-builder/issues/739#issuecomment-3461659821, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHGZY35Z22DBHHKN5PZDTT32DBJFAVCNFSM6AAAAACH6BRQVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTINRRGY2TSOBSGE . You are receiving this because you modified the open/close state.Message ID: @.***>

-- Best Regards,

Sebastiano Mandalà

sebas77 avatar Oct 29 '25 14:10 sebas77