Version: 2018.4
JSON Serialization
ScriptableObject

Streaming Assets

Многие ассеты в Unity комбинируются при сборке в проект. Тем не менее, иногда полезно размещать файлы на указанном компьютере в нормальной файловой системе, чтобы сделать их доступными через пути. В качестве примера можно привести развёртку файла фильма на iOS устройства; оригинальный файл должен находиться в файловой системе, чтобы его можно было проиграть с помощью функции PlayMovie.

Все файлы, помещённые в папку под названием StreamingAssets в Unity проекте будут скопированы в определённую папку на указанный компьютер. Вы можете извлечь папку используя свойство Application.streamingAssetsPath. Для справки, расположение этой папки меняется в зависимости от платформы:

The location of this folder varies per platform. Please note that these are case-sensitive:

  • On a desktop computer (Mac OS or Windows) the location of the files can be obtained with the following code:

     path = Application.dataPath + "/StreamingAssets";
    
  • На iOS, вам следует использовать:

     path = Application.dataPath + "/Raw";
    
  • На Android, вам следует использовать:

     path = "jar:file://" + Application.dataPath + "!/assets/";
    

On Android, the files are contained within a compressed .jar file (which is essentially the same format as standard zip-compressed files). This means that if you do not use Unity’s WWW class to retrieve the file, you need to use additional software to see inside the .jar archive and obtain the file.

Note: .dll files located in the StreamingAssets folder don’t participate in the compilation.

JSON Serialization
ScriptableObject
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961