Analytics Not Working from Command Line Build


We recently added UGS analytics to our project, and everything is working as we expect from local editor builds. The issue arises when building from command line, which we use for autobuilds, as analytics is not working at all in these builds. We are getting a line in the command line output that says: [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 []( to sign up.
I have been looking at the UGS CLI, but I am having trouble figuring out how / if this would help set up analytics for command line builds.

Can you confirm if your editor is indeed linked to your project in dashboard?

Sorry for late reply. Yes, our editor is indeed linked to the project in dashboard. Builds from editor are correctly connecting to UGS and we are getting analytic events. Not sure what steps are needed for a command line headless build.

I have checked the ProjectSettings.asset file before and after a command line batchmode build, and it has the correct settings. Is it importing it wrong during a build? I have tried to debug the CloudProjectSettings.projectId during a build, but it appears to run before the buildscript imports the settings and returns an empty string.

Full graphics unity editor is logged in and project settings are correct in the asset file. We are even passing valid credentials to the unity command line batchmode nographics build so that it has a valid account. We use Jenkins; is there any reason that CloudProjectSettings.projectId would get unset via command line?

Hey there!

I checked with some of the engineers on this, and yes it's expected in certain circumstances.
We do a quick security check to ensure that the logged in user has permission to access the project in question, if not then the projectId is stripped out.

If you find yourself logged out of the Unity Hub and try to build, you'll find the behaviour is the same on your local machine.

Double check that your Jenkins pipeline is factoring the Unity Hub & your login credentials during the build - it's not an area of my own focus so I don't have any direct pointers for where or what to look for, I'll ask around internally and see if I can connect with the correct team and update here if I find anything.

Started getting same message using unity cloud build, our analytics don't work now.

One of my coworkers found a UGS.exe buried somewhere in the docs that we can call in the jenkins build pipeline prior to the headless build call that allows us to have ugs up. Its hacky but it works. I'll see if he remembers where he found that exe.

Could you tell me where I can find UGS.exe?

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.

1 Like