How to get the artifacts?

I can’t believe I am actually asking this, since it is the only purpose of a Cloud Build solution, but then again, it’s made by Unity.

How do I get the path to the actual build artifact so that I can automatically copy it to S3 or some other location? Before I start to dissect the build process by dumping all environment info and file system data into the logs, maybe there is some way that’s apparently not documented, how to get the artifacts?

1 Like

Hi @notagame ,

These environment variables should be available for you to use in your post-build scripts.

  • UNITY_PLAYER_PATH → .exe (Windows), .x64_86 (Linux), .app (macOS), .ipa (iOS), .apk (single architecture), .aab, webGL folder
  • UNITY_PLAYER_PATH_DSYM → dsym file for iOS builds
  • UNITY_PLAYER_PATH_DATA → data folder for headless Linux builds
  • UNITY_PLAYER_PATH_MAIN_OBB → .obb file for Android builds when Split Application Binary is enabled. If there are more OBB’s with different suffixes, there will be more environment variables based on the suffix.
  • UNITY_PLAYER_PATH_ARCHITECTURE → APK file for each architecture in the Player Settings when the option Split APKs by target architecture is enabled. Example: UNITY_PLAYER_PATH_ARM64V8A

Thanks for pointing out that these are not well documented. I’ll pass on this information to the Documentation team for review.

I hope this helps!

UNITY_PLAYER_PATH seems to be empty for me

#!/bin/bash
echo "Uploading APK to Oculus..."

appId="${APP_ID}"
userToken="${USER_TOKEN}"

echo "$appId"

echo "$userToken"

echo "'$UNITY_PLAYER_PATH'"

src/BaselineZ/Assets/Oculus/VR/Editor/Tools/ovr-platform-util.exe upload-quest-build --app_id $appId --token $userToken --apk "'$UNITY_PLAYER_PATH'" --channel alpha --notes "Uploaded via Unity Cloud Build"

I also tried UNITY_PLAYER_PATH_ARM64V8A and that didn’t work.

Any idea why?

I had to turn on single architecture: PlayerSettings.Android.buildApkPerCpuArchitecture = false;

But still no APK found on that location. Any help is appreciated.

For people who have the same issue as me (this can be used for all windows based CLI):

windowsPath=$(cygpath -w "$UNITY_PLAYER_PATH")

Should do the trick :smile:

We really need proper Unity Cloud Build documentation…

3 Likes

Many Thanks @FrankdenUijlBaselinez works perfect for me!!

You need to check if cygpath command exists before using it, or it will fail the script.

#!/bin/sh

# check if cygpath command exists
if [ -x "$(command -v cygpath)" ]; then
    # we have cygpath
else
    # no cygpath
fi

And for anyone else that happens to pop in and take a look. We do have environment variables documented here: Unity Cloud Build

Please let us know if there are any clarifications or improvements you would like to see made to those docs.

Having the same issue. $UNITY_PLAYER_PATH does not point to a valid APK. The variable is not empty but the APK does not exist at the path it specifies.

What are you seeing it point to? Opening a support ticket through the Unity Cloud Build Dashboard can help us dig into this a little more and figure out what you are seeing for your specific builds.

The new documentation is still not specific enough. I needed to find this forum post to understand the specifics.