Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How to copy folder from Asset to xcode project as folder references?

Discussion in 'iOS and tvOS' started by iamau5, Jul 21, 2017.

  1. iamau5

    iamau5

    Joined:
    Oct 19, 2015
    Posts:
    13
    Hi guys,

    I have googling and messeing around for a while and here is a code I end up with

    Code (CSharp):
    1.     [PostProcessBuild]
    2.     public static void MyPostProcess(BuildTarget buildTarget, string pathToBuiltProject) {
    3.         if (buildTarget == BuildTarget.iOS) {
    4.      
    5.             string projPath = PBXProject.GetPBXProjectPath(pathToBuiltProject);
    6.             PBXProject proj = new PBXProject();
    7.    
    8.             proj.ReadFromString(File.ReadAllText(projPath));
    9.             string target = proj.TargetGuidByName("Unity-iPhone");
    10.  
    11.             proj.AddFileToBuild(target,proj.AddFolderReference(Application.dataPath+"/Plugins/test/chocobo.png", "test/chocobo.png"));
    12.             File.WriteAllText(projPath, proj.WriteToString());
    13.         }
    14.     }
    What I got after postprocess is this. (Group)


    But this is what I expected. (Folder References)


    Through the process when draging the folder into the project like this.


    Can anyone tell me how to do this? Thanks!
     

    Attached Files:

    Fattie likes this.
  2. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    475
    I would love this explained !
     
  3. rdvt

    rdvt

    Joined:
    Aug 23, 2014
    Posts:
    23
    Just include in the Streamingassets folder
     
  4. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    475
    True, but then it ends up in /Raw/Data

    I'd really rather use the Copy function .. to put it in the bundle root.