Search Unity

Replacing Xcode's images.xcassets

Discussion in 'Unity Build Automation' started by kathode, Feb 11, 2018.

  1. kathode

    kathode

    Joined:
    Jan 15, 2013
    Posts:
    63
    When making local builds, I have a saved off version of Images.xcassets that I just copy over before I archive the build for sending to Apple.

    Is there a way to do this with post-build scripts for Cloud Build? Perhaps with the PBXProject.AddFile functionality? If so, I'd appreciate someone giving me hints as to the proper paths I should use.

    Thanks!
     
    fduffner likes this.
  2. kathode

    kathode

    Joined:
    Jan 15, 2013
    Posts:
    63
    Figured it out with some experimentation, and it's pretty simple in the end.

    Code (CSharp):
    1.         string srcFilePath1 = Application.dataPath + "/IOSRequiredFiles/Images.xcassets/AppIcon.appiconset";
    2.         string dstFilePath1 = path + "/Unity-iPhone/Images.xcassets/AppIcon.appiconset";
    3.  
    4.         string srcFilePath2 = Application.dataPath + "/IOSRequiredFiles/Images.xcassets/LaunchImage.launchimage";
    5.         string dstFilePath2 = path + "/Unity-iPhone/Images.xcassets/LaunchImage.launchimage";
    6.  
    7.         FileUtil.DeleteFileOrDirectory(dstFilePath1);
    8.         FileUtil.CopyFileOrDirectory(srcFilePath1, dstFilePath1);
    9.  
    10.         FileUtil.DeleteFileOrDirectory(dstFilePath2);
    11.         FileUtil.CopyFileOrDirectory(srcFilePath2, dstFilePath2);
    It seemed to generate IOExceptions when I tried to operate on the Images.xcassets directory itself, but the two subdirectories did not have any issue.
     
  3. playsidepaul

    playsidepaul

    Joined:
    Sep 23, 2015
    Posts:
    11
    Thanks for this... what do you use (or pass in) for "path"?

    Edit: never mind, just realised it's a parameter in OnPostprocessBuild(BuildTarget buildTarget, string path)
     
    Last edited: Feb 13, 2018
    fduffner and kathode like this.