- Home /
A way copy my extra files to the Build?
I have some files which are not normal resources. Like odd file extensions (not txt or jpg etc.). I want to make sure they get copied to the 'data' folder when the game gets built. I was hoping I could just put them in Resources or Plugins but that's not working. Can I do this easily, or do I need to write a custom editor script to build and copy?
UIToolkit overcomes this limitation by forcing the developer to rename odd file extensions to .txt so that they are included in the build. Your custom loading scripts can then load the file and use it as desired. I do not know if this is appropriate for you, but it certainly works for them.
Answer by JimmyJJeeter · Aug 23, 2012 at 06:44 PM
Well 3.5.2 gave me just what I needed: http://docs.unity3d.com/Documentation/ScriptReference/PostProcessBuildAttribute.html
Answer by Bunny83 · Apr 23, 2012 at 09:58 PM
Unfortunately there is no delegate or callback when the building process has finished (at least non that i know).
You can however use a Perl script that is executed after the build. See PostprocessBuildPlayer
edit If you have Unity pro i guess it should be possible to just write an editorscript which creates the build manually. See BuildPipeline
Thanks for the link. Perl!? Does it have to be Perl?
Well, I'm not sure. It's not really documented ;) I haven't used it yet...
If there are really that many files you have to copy you could also create a batchfile you just have to run. It could also start the build afterwards ;)
Another way could be to create some kind of sym-link in the data folder so your extra files are mapped into the folder. Never tried something like that. $$anonymous$$aybe this doesn't work.
Good ideas, thanks. It would have to copy after the build, because the build clears the folders of these extra files, hence the problem. If it would just overwrite but not delete files in the build folder, it would be ok.
What kind of extra files are you talking about? Since they aren't registrated in Unity's assetdatabase you could simply add them to a different folder? Btw: are you talking about a standalone build or a webbuild?
For standalone build you could have just a second folder with your "external stuff" right beside the exe and the data folder
It's standalone, files are .pcx, .txt, and some others. I didn't know Unity would find them outside the data path, can that be relative? like Application.dataPath + "..\\externals" ??
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Loading scenes from folder? 3 Answers
Get raw script of a Unity component 2 Answers
Unity freezes when building a project - when Building Resources Folder 3 Answers
Unbuild / Extract files from build 4 Answers