(文档)流媒体资源 Streaming Assets

Most assets in Unity are combined into the project when it is built. However, it is sometimes useful to place files into the normal filesystem on the target machine to make them accessible via a pathname. An example of this is the deployment of a movie file on iOS devices; the original movie file must be available from a location in the filesystem to be played by the PlayMovie function.

当项目生成时Unity中的大多数资源都被整合到项目中。然而,在目标机器放置文件到正常文件系统中,有时很有用的。这样的一个例子是iOS设备上的电影文件的部署;在文件系统中的原始影片可以通过PlayMovie函数播放。

Any files placed in a folder called StreamingAssets in a Unity project will be copied verbatim to a particular folder on the target machine. On a desktop computer (Mac OS or Windows) the location of the files can be obtained with the following code:-

放在Unity项目中名为StreamingAssets文件夹中的任何文件将会被一字不差地复制到目标机器上的特定文件夹里。(Mac OS或Windows)桌面计算机上的文件的位置可以用下面的代码获得:-

path = = Application.dataPath + "/StreamingAssets";

On iOS, you should use:- 
在iOS上,你应该使用:-

path = Application.dataPath + "/Raw";

...while on Android, you should use:- 
而在Android上,应该使用:-

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

Note that 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 then you will need to use additional software to see inside the .jar archive and obtain the file.

请注意Android手机中的文件都包含在压缩的.jar文件中(这基本上与标准的zip压缩文件的格式相同)。这意味着,如果你不使用Unity中的WWW类去检索文件,那么你需要使用额外的软件去查看.jar的存档并获取该文件。

原文地址:https://www.cnblogs.com/wonderKK/p/4283145.html