[RESOLVED] How to process directories in Unity Cloud Build Post-Export ?

Hello within postExport method, I’m looking to dynamically get info of addressables folder and BurstDebugInformation_DoNotShip folder which are created during UCB process.

 public static void OnPostExport(string exportPath) {

        if (Directory.Exists(Application.streamingAssetsPath)) {
            Debug.Log("streamingAssets folder does exists");
        } else {
            Debug.Log("streamingAssets folder can't be found");
        }
}

I receive, both in local and cloud build:

streamingAssets folder does exists

So I’ve tried a directory exists for addressables assets. But it returns me that it doesn’t exist, despite the code working when I test it in local (by reproducing the assets folder structure).
Please note that I’m sure the folder I’m looking for exists: the path is logged during the ucb process while addressables are being generated. And it’s also the right one when I look at the final build, since they’re built-as-included.

Basically

if (Directory.Exists(Path.Combine(Application.streamingAssetsPath, "aa", "StandaloneWindows64"))) {
            info = new DirectoryInfo(Path.Combine(Application.streamingAssetsPath, "aa", "StandaloneWindows64"));
        } else {
            Debug.Log("couldn't find path of " + Path.Combine(Application.streamingAssetsPath, "aa", "StandaloneWindows64"));
        }

The directory is found in local, but not in post-export function of cloud build.

I’ve tried a variation with:

if (Directory.Exists(Path.Combine("Assets", "StreamingAssets", "aa", "StandaloneWindows64"))) {
            info = new DirectoryInfo(Path.Combine("Assets", "StreamingAssets", "aa", "StandaloneWindows64"));
        } else {
            Debug.Log("couldn't find path of " + Path.Combine("Assets", "StreamingAssets", "aa", "StandaloneWindows64"));
        }

But same issue.

i wanted also to get the directory of ‘BurstDebugInformation_DoNotShip’ generated in the root folder, to delete it, but CloudBuild couldn’t find it either in post-export.

if (Directory.GetDirectoryRoot("IFSCL_BurstDebugInformation_DoNotShip") == null) {
            Debug.LogWarning("Burst directory found");
        } else {
            Debug.LogWarning("Couldn't find burst directory");
        }

Does anybody have some insight ? Should I use more the exportPath string in some way (documentation is not super clear though…) ? Am I trying to edit folders that are already zipped at this stage of the process ?

I’m using 2020.3.36f1

Edit: I’ve tried, without luck, using exportPath:
found path of: /BUILD_PATH/immu.ifscl.win/Assets/StreamingAssets
couldn't find path of: /BUILD_PATH/immu.ifscl.win/Assets/StreamingAssets/aa/StandaloneWindows64

I’ve not used addressables before but do you think it could be because the ‘copy to streaming assets’ checkbox hasn’t been set?

8254797--1080399--upload_2022-7-5_10-40-38.png

For debugging purposes you could add a bit of code to output all the files in that folder, just to make sure it’s what you expect. For example:

string[] entries = Directory.GetFileSystemEntries(path, "*", SearchOption.AllDirectories);

Out of interest, there’s a post here with some code to delete that burst debug folder so maybe that would be helpful in locating it: BurstDebugInformation_DoNotShip in builds

1 Like

(Regarding the option, yes the checkbox was already set)

Thanks! The burst part worked. I just had to replace the buildmanifest info with the ‘exportPath’ relative to the postExport method and it worked like a charm.

The
Directory.GetFileSystemEntries(exportPath, “", SearchOption.AllDirectories);
and
Directory.GetFileSystemEntries(exportPath, "
”, SearchOption.TopDirectoryOnly);
gave empty strings, quite weirdly.

Nevertheless, for the streamingAsset (and addressable) path, I tried getting the directory with a different path this time, based on the export path :
Path.Combine(exportPath.Replace(“Game.exe”, “”), “Game_Data”, “StreamingAssets”, “aa”, “StandaloneWindows64”);
Which finally worked as expected!

1 Like