- Мой обходной путь состоял в том, чтобы скопировать файлы из Application.streamingAssetsPath (который находится внутри jar и не может быть доступен большинству собственных библиотек) в Application.persistentDataPath (который полностью подходит), а затем передатьэтот путь к собственному коду.
- Исходные файлы в проекте должны находиться в папке Assets \ StreamingAssets
Небольшой пример кода на c # для асинхронного копирования файлов: добавьте этот метод в скрипткоторый наследует MonoBehaviour
IEnumerator CopyFileAsyncOnAndroid()
{
string fromPath = Application.streamingAssetsPath +"/";
//In Android = "jar:file://" + Application.dataPath + "!/assets/"
string toPath = Application.persistentDataPath +"/";
string[] filesNamesToCopy = new string[] { "a.txt" ,"b.txt"};
foreach (string fileName in filesNamesToCopy)
{
Debug.Log("copying from "+ fromPath + fileName +" to "+ toPath);
WWW www1 = new WWW( fromPath +fileName);
yield return www1;
Debug.Log("yield done");
File.WriteAllBytes(toPath+ fileName, www1.bytes);
Debug.Log("file copy done");
}
//ADD YOUR CALL TO NATIVE CODE HERE
//Note: 4 small files can take a second to finish copy. so do it once and
//set a persistent flag to know you don`t need to call it again
}