Search Unity

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

Discussion in 'Unity Build Automation' started by Immu, Jul 5, 2022.

  1. Immu

    Immu

    Joined:
    Jun 18, 2013
    Posts:
    240
    Hello within postExport method, I'm looking to dynamically get info of addressables folder and BurstDebugInformation_DoNotShip folder which are created during UCB process.

    Code (CSharp):
    1.  public static void OnPostExport(string exportPath) {
    2.  
    3.         if (Directory.Exists(Application.streamingAssetsPath)) {
    4.             Debug.Log("streamingAssets folder does exists");
    5.         } else {
    6.             Debug.Log("streamingAssets folder can't be found");
    7.         }
    8. }
    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
    Code (CSharp):
    1. if (Directory.Exists(Path.Combine(Application.streamingAssetsPath, "aa", "StandaloneWindows64"))) {
    2.             info = new DirectoryInfo(Path.Combine(Application.streamingAssetsPath, "aa", "StandaloneWindows64"));
    3.         } else {
    4.             Debug.Log("couldn't find path of " + Path.Combine(Application.streamingAssetsPath, "aa", "StandaloneWindows64"));
    5.         }
    The directory is found in local, but not in post-export function of cloud build.

    I've tried a variation with:
    Code (CSharp):
    1. if (Directory.Exists(Path.Combine("Assets", "StreamingAssets", "aa", "StandaloneWindows64"))) {
    2.             info = new DirectoryInfo(Path.Combine("Assets", "StreamingAssets", "aa", "StandaloneWindows64"));
    3.         } else {
    4.             Debug.Log("couldn't find path of " + Path.Combine("Assets", "StreamingAssets", "aa", "StandaloneWindows64"));
    5.         }
    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.
    Code (CSharp):
    1. if (Directory.GetDirectoryRoot("IFSCL_BurstDebugInformation_DoNotShip") == null) {
    2.             Debug.LogWarning("Burst directory found");
    3.         } else {
    4.             Debug.LogWarning("Couldn't find burst directory");
    5.         }
    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
     

    Attached Files:

    Last edited: Jul 5, 2022
  2. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,087
    I've not used addressables before but do you think it could be because the 'copy to streaming assets' checkbox hasn't been set?

    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:

    Code (CSharp):
    1. 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: https://forum.unity.com/threads/burstdebuginformation_donotship-in-builds.1172273/#post-8103611
     
    Last edited: Jul 5, 2022
    Immu likes this.
  3. Immu

    Immu

    Joined:
    Jun 18, 2013
    Posts:
    240
    (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!
     
    tonemcbride likes this.