Can I have StreamingAssets directory nested lower in the Assets directory?
I need to stream assets in my package since they will be read from the filesystem by a native plugin. I need (will skip the details why, feel free to ask if you're curious) to have those files in a folder that isn't at the top level, aka:
Assets/StreamingAssets
won't work for meAssets/someFolder/StreamingAssets
would be ideal
The doc is not quite clear regarding what can be done:
Any files placed in a folder called StreamingAssets (case-sensitive) in a Unity project will be copied verbatim to a particular folder on the target machine.
However, it seems that if that StreamingAssets
folder isn't under Assets
, it won't work.
Would you know of any workaround to "copy" those files in the package filesystem from a different location that Assets\StreamingAssets
? It's too bad because other "special" directories like Plugins
, Editor
, Resources
etc. do not need to be at the top level.
Answer by agirault · Nov 19, 2018 at 02:14 PM
Answer from Premium support:
The streaming folder does need to be in the root. There are some workarounds using the editor script as an alternative and using System.IO.File.Copy.
StreamingAssets is just a folder that gets File.Copy to the build, you can do the process in PostProcessbuild to copy the files from elsewhere depending on the build platform you use. StreamingAssetsPath directs to a single location: if you had it on a different location this process would not work.
Still not sure about the details, so I'll have to test things and come back with a more detailed solution.
Your answer
Follow this Question
Related Questions
cannot create WEBGL game 0 Answers
OSX Xcode Project 0 Answers
Why does Unity Cloud Build Keep Failing? 1 Answer
How to reduce the size of Unity build for Windows platform ? 0 Answers
Some scripts stop working on build but work in editor? 1 Answer