Application.streamingAssetsPath

  This API contains the path to the StreamingAssets folder (Read Only).

  If you have a "StreamingAssets" folder in the Assets folder of your project, it will be copied to your player builds and be present in the path given by Application.streamingAssetsPath.

  Note that on some platforms it is not possible to directly access the StreamingAssets folder because there is no file system access in the web platforms, and because it is compressed into the .apk file on Android. On those platforms, a url will be returned, which can be used using the WWW class.

 using UnityEngine;
using System.Collections; public class ExampleClass : MonoBehaviour {
public string filePath = System.IO.Path.Combine(Application.streamingAssetsPath, "MyFile");
public string result = "";
IEnumerator Example() {
if (filePath.Contains("://")) {
WWW www = new WWW(filePath);
yield return www;
result = www.text;
} else
result = System.IO.File.ReadAllText(filePath);
}
}

Details

   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.

  

  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.

  It’s always best to use Application.streamingAssetsPath to get the location of the StreamingAssets folder, it will always point to the correct location on the platform where the application is running.

Application.streamingAssetsPath的更多相关文章

  1. Application中的路径

    前提条件 项目工程目录:E:/Work/cosmosbox/cb-client/ 我电脑当前的用户名:qingqing PersistentDataPath Application.persisten ...

  2. Unity3D各平台Application.xxxPath的路径

    前几天我们游戏在一个同事的Android手机上启动时无法正常进入,经查发现Application.temporaryCachePath和Application.persistentDataPath返回 ...

  3. (转)Unity3D研究院之手游开发中所有特殊的文件夹(assetbundle与Application.persistentDataPath)

    这里列举出手游开发中用到了所有特殊文件夹. 1.Editor Editor文件夹可以在根目录下,也可以在子目录里,只要名子叫Editor就可以.比如目录:/xxx/xxx/Editor  和 /Edi ...

  4. 安卓 通过www读取Application.persistentDataPath

    今天在读取Application.persistentDataPath路径下的图片时,在前面加上“file:///” 例如 #if UNITY_EDITOR || UNITY_STANDALONE r ...

  5. Unity3D 5.3 新版AssetBundle使用方案及策略

    1.概览 Unity3D 5.0版本之后的AssetBundle机制和之前的4.x版本已经发生了很大的变化,一些曾经常用的流程已经不再使用,甚至一些老的API已经被新的API所取代. 因此,本文的主要 ...

  6. Unity AssetBundle爬坑手记

    这篇文章从AssetBundle的打包,使用,管理以及内存占用各个方面进行了比较全面的分析,对AssetBundle使用过程中的一些坑进行填补指引以及喷!   AssetBundle是Unity推荐的 ...

  7. Unity3D移动平台动态读取外部文件全解析

    前言: 一直有个想法,就是把工作中遇到的坑通过自己的深挖,总结成一套相同问题的解决方案供各位同行拍砖探讨.眼瞅着2015年第一个工作日就要来到了,小匹夫也休息的差不多了,寻思着也该写点东西活动活动大脑 ...

  8. Unity 文件读取

    存储: 在程序发布后文件的存放有两种,第一种是打包到Uniyt的资源包中(*.unity3D),第二种就是把文件存放在一个特殊的目录如:StreamingAssets,这个目录的东西Unity不会打包 ...

  9. GJM : Unity调用系统窗口选择本地文件

    感谢您的阅读.喜欢的.有用的就请大哥大嫂们高抬贵手"推荐一下"吧!你的精神支持是博主强大的写作动力以及转载收藏动力.欢迎转载! 版权声明:本文原创发表于 [请点击连接前往] ,未经 ...

随机推荐

  1. android中string.xml中%一$s、%1$d等的用法

    %n$ms:代表输出的是字符串,n代表是第几个参数,设置m的值可以在输出之前放置空格 %n$md:代表输出的是整数,n代表是第几个参数,设置m的值可以在输出之前放置空格,也可以设为0m,在输出之前放置 ...

  2. 【解决方案】django初始化执行python manage.py migrate命令后,除default数据库之外的其他数据库中的表没有创建出来

    [问题原因]:django工程中存在多个应用,每个应用都指定了对应的数据库.执行python manage.py migrate命令时没有指定数据库,将只初始化默认的default数据库. [解决方案 ...

  3. oracle创建定时器详解|interval属性

    定时任务首先先创建定时任务中的存储过程 create or replace procedure pro_jggl as                                          ...

  4. Unable to connect to any of the specified MySQL hosts.

    c#连接Mysql数据建立连接时提示:Unable to connect to any of the specified MySQL hosts. 出现此错误的原因是Server(数据库服务器IP地址 ...

  5. Buildroot 打包文件系统流程跟踪

    /********************************************************************************* * Buildroot 打包文件系 ...

  6. Python windows ping

    # -*- coding: utf-8 -*- import os # 参考文档: # Ping to a specific IP address using python [duplicate] # ...

  7. javascript reg 不加入分组

    from :https://stackoverflow.com/questions/3512471/what-is-a-non-capturing-group-what-does-a-question ...

  8. docker默认配置文件不存在问题解决

    Docker默认的配置文件/etc/default/docker或者/etc/sysconfig/docker都不起作用,查看了一下/lib/systemd/system/docker.service ...

  9. 解决hue查询中文报错问题

    hue 4.0查询查询中包含中文报一下错误 (1366, Incorrect string value: \\xE4\\xBA\\xAC\\xE4\\xB8\\x9C... for column se ...

  10. 学习blus老师js(4)--DOM

    一.DOM节点 1.获取子节点: childNodes  nodeType         节点类型 children            只包括元素,不包括文本:  子节点只算第一层.只算孩子一级 ...