Application路径
2016-07-19 14:48
323 查看
根目录:StreamingAssets文件夹
#if UNITY_EDITOR
string filepath = Application.dataPath +"/StreamingAssets"+"/my.xml";
#elif UNITY_IPHONE
string filepath = Application.dataPath +"/Raw"+"/my.xml";
#elif UNITY_ANDROID
string filepath = "jar:file://" + Application.dataPath + "!/assets/"+"/my.xml;
#endif
根目录:Resources 文件夹
可以使用Resources.Load("名字"); 把文件夹中的对象加载出来
根目录:StreamingAssets 文件夹
可以使用Application.dataPath进行读操作
Application.dataPath: 只可读不可写,放置一些资源数据
Application.persistentDataPath
iOS与Android平台都可以使用这个目录下进行读写操作,可以存放各种配置文件进行修改之类的。
在PC上的地址是:C:\Users\用户名 \AppData\LocalLow\DefaultCompany\test
Unity Editor: <path tp project folder>/Assets
Unity 编辑器:<工程文件夹的路径>/Assets
Mac player: <path to player app bundle>/Contents
Mac播放器:<到播放器应用的路径>/Contents
iPhone player: <path
to player app bundle>/<AppName.app>/Data
iPhone播放器:<到播放器应用的路径>/<AppName.app>/Data
Win player: <path to executablename_Data folder>
Win播放器:< 包含可执行播发器的文件夹的路径>\Data
Dashboard widget: <path to the dashboard widget bundle>
Dasboard窗口:< dashboard widget bundle的路径>
Web player: The absolute url to the player data file folder (without
the actual data file name)
网络播放器:到播放器数据文件夹的绝对路径(没有实际的数据文件名称)
• Resources文件夹下的资源无论使用与否都会被打包
• 资源会被压缩,转化成二进制
• 打包后文件夹下的资源只读
• 无法动态更改,无法做热更新
• 使用Resources.Load加载
• 流数据的缓存目录
• 文件夹下的资源无论使用与否都会被打包
• 资源不会被压缩和加密
• 打包后文件夹下的资源只读,主要存放二进制文件
• 无法做热更新
• WWW类加载(一般用CreateFromFile ,若资源是AssetBundle,依据其打包方式看是否是压缩的来决定)
• 相对路径,具体路径依赖于实际平台
•Application.streamingAssetsPath
• IOS: Application.dataPath + “/Raw” 或Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxx.app/Data/Raw
• 游戏的数据文件夹的路径(例如在Editor中的Assets)
• 很少用到
• 无法做热更新
• IOS路径: Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxx.app/Data
• 持久化数据存储目录的路径( 沙盒目录,打包之前不存在 )
• 文件夹下的资源无论使用与否都会被打包
• 运行时有效,可读写
• 无内容限制,从StreamingAsset中读取二进制文件或从AssetBundle读取文件来写入PersistentDataPath中
• 适合热更新
• IOS路径: Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Documents
#if UNITY_EDITOR
string filepath = Application.dataPath +"/StreamingAssets"+"/my.xml";
#elif UNITY_IPHONE
string filepath = Application.dataPath +"/Raw"+"/my.xml";
#elif UNITY_ANDROID
string filepath = "jar:file://" + Application.dataPath + "!/assets/"+"/my.xml;
#endif
根目录:Resources 文件夹
可以使用Resources.Load("名字"); 把文件夹中的对象加载出来
根目录:StreamingAssets 文件夹
可以使用Application.dataPath进行读操作
Application.dataPath: 只可读不可写,放置一些资源数据
Application.persistentDataPath
iOS与Android平台都可以使用这个目录下进行读写操作,可以存放各种配置文件进行修改之类的。
在PC上的地址是:C:\Users\用户名 \AppData\LocalLow\DefaultCompany\test
Application.dataPath : 数据路径
Unity Editor: <path tp project folder>/AssetsUnity 编辑器:<工程文件夹的路径>/Assets
Mac player: <path to player app bundle>/Contents
Mac播放器:<到播放器应用的路径>/Contents
iPhone player: <path
to player app bundle>/<AppName.app>/Data
iPhone播放器:<到播放器应用的路径>/<AppName.app>/Data
Win player: <path to executablename_Data folder>
Win播放器:< 包含可执行播发器的文件夹的路径>\Data
Dashboard widget: <path to the dashboard widget bundle>
Dasboard窗口:< dashboard widget bundle的路径>
Web player: The absolute url to the player data file folder (without
the actual data file name)
网络播放器:到播放器数据文件夹的绝对路径(没有实际的数据文件名称)
重要路径之 之Resources
• Resources文件夹下的资源无论使用与否都会被打包• 资源会被压缩,转化成二进制
• 打包后文件夹下的资源只读
• 无法动态更改,无法做热更新
• 使用Resources.Load加载
重要路径之StreamingAssets
• 流数据的缓存目录• 文件夹下的资源无论使用与否都会被打包
• 资源不会被压缩和加密
• 打包后文件夹下的资源只读,主要存放二进制文件
• 无法做热更新
• WWW类加载(一般用CreateFromFile ,若资源是AssetBundle,依据其打包方式看是否是压缩的来决定)
• 相对路径,具体路径依赖于实际平台
•Application.streamingAssetsPath
• IOS: Application.dataPath + “/Raw” 或Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxx.app/Data/Raw
重要路径之Application.dataPath
• 游戏的数据文件夹的路径(例如在Editor中的Assets)• 很少用到
• 无法做热更新
• IOS路径: Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxx.app/Data
重要路径之Application.persistentDataPath
• 持久化数据存储目录的路径( 沙盒目录,打包之前不存在 )• 文件夹下的资源无论使用与否都会被打包
• 运行时有效,可读写
• 无内容限制,从StreamingAsset中读取二进制文件或从AssetBundle读取文件来写入PersistentDataPath中
• 适合热更新
• IOS路径: Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Documents
相关文章推荐
- Android开发经典书籍
- Application路径
- Unity UGUI —— 无限循环List(转载)
- 安卓分享纯图片
- Android中Recyclerview使用6----添加条目得到点击事件和长按事件(另一种写法,较简单)
- iOS8 定位当前城市
- Android ListView 隐藏自带分割线
- android--xUtils开发框架
- native app 集成 cocos-2dx-js 3.11 (Android篇)
- Error running app: Instant Run requires 'Tools | Android | Enable ADB integration' to be enabled.
- Android逆向分析案例——某地图的定位请求分析
- Android中定时器Timer和TimerTask的启动,停止,暂停,继续等操作实例
- GreenDao_2.介绍GreenDao
- 推荐几款实用的Android Studio 插件
- Android开发将List转化为JsonArray和JsonObject
- Swift解包拆包方式
- CABasicAnimation 使用
- android simpledraweeview 获取已经加载的图片bitmap
- webView与js交互——获取通讯录手机号并显示运营商
- Android listview 点击问题