in Unity I simply have a file, afile.ts, sitting in Assets/
In the built Xcode, I simply want it to be sitting in the project folder (really, anywhere is fine) included in the project.
You do this using
project.AddFileToBuild(g, something something something);
But I plain can not figure it out.
(Obviously it is totally undocumented at Unity.)
How is it done? Just the one simple file - actually copy it from Assets/filename to the Xcode project (and it will have target membership and be in the main bundle).
Here is a perfect Unity build post script BuildPostProcessor.cs, which is amazing and does everything else:
https://stackoverflow.com/a/54370793/294884
but I cannot copy over a damned file! How to?
Note - alternative
Note. If you very simply put a file in Unity's badly-named magic folder:
/StreamingAssets
in fact it does exactly what is under discussion in this QA.
- Unity .. have a file music.mp4 or mesh.txt in /StreamingAssets
- build to Xcode
- you'll have music.mp4 or mesh.txt, in the Xcode project, included in the Target
- and the iOS location will be ...
the folder name on iOS for whatever reason becomes: /Data/Raw
Thus your low-level iOS side code would be:
instead of, for example:
CFURLRef imageURL = CFBundleCopyResourceURL(
mainBundle, CFSTR("music"), CFSTR("mp4"), NULL);
you will have:
CFURLRef imageURL = CFBundleCopyResourceURL(
mainBundle, CFSTR("Data/Raw/music"), CFSTR("mp4"), NULL);
That works fine. But surely we can learn how to use '.AddFileToBuild` which seems to exist for the purpose.