关于移动平台路径
来源:互联网 发布:程序员个人工作体会 编辑:程序博客网 时间:2024/04/30 02:23
关于移动平台路径
1、下面这段代码是要要得到本地路径,如果没有的话,会创建该路径
//----------------------------得到本地路径------------------------------ public static string GetLocalPath() {string path = "";string filepath = "jar:file://" + Application.dataPath + "!/assets/";#if UNITY_ANDROIDpath = "jar:file://" + Application.dataPath + "!/assets/";#elif UNITY_IPHONE path = Application.persistentDataPath;#elif UNITY_STANDALONE_WIN || UNITY_EDITOR path = Application.dataPath;#else //string.Empty;#endif string dataFilePath = path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); dataFilePath = dataFilePath.Substring(0, dataFilePath.LastIndexOf(Path.DirectorySeparatorChar)); if (dataFilePath.EndsWith(".app")) { dataFilePath = dataFilePath.Substring(0, dataFilePath.LastIndexOf(Path.DirectorySeparatorChar)); } string dataPath = dataFilePath + Path.DirectorySeparatorChar + "Documents"; if (!Directory.Exists(dataPath)) { Directory.CreateDirectory(dataPath); } return dataPath + Path.DirectorySeparatorChar; }
2、下面的这段代码是使用www加载本地资源时写的,基本都会用到的
//www 加载本地文件路径 public static string GetLocalPathByWWW() { string path = "file://" + Application.streamingAssetsPath;#if UNITY_EDITOR path = "file://" + Application.streamingAssetsPath;#elif UNITY_ANDROID path= "jar:file://" + Application.dataPath + "!/assets";#elif UNITY_IPHONE path = "file://" + Application.streamingAssetsPath;#endif return path; }3、下面这段代码是在嵌入网页时加载本地网页写的,没办法UNiwebview只是别安卓的这个路径
public static string GetUrl() { string path = "file://" + Application.streamingAssetsPath;#if UNITY_EDITOR path = "file://" + Application.streamingAssetsPath;#elif UNITY_ANDROID path= "file:///android_asset";#elif UNITY_IPHONE path = "file://" + Application.streamingAssetsPath;#endif return path; }
0 0
- 关于移动平台路径
- 移动平台资源路径问题
- unity移动平台路径问题
- 【unity3d】移动平台各资源路径
- U3D移动平台的资源路径问题
- Unity3D 移动平台Path对应路径以及文件路径权限
- Unity3D 移动平台Path对应路径以及文件路径权限
- 关于移动平台工程的一些心得
- 关于移动广告平台的基本常识
- 关于远程教育行业的移动平台设计
- 【Unity】关于各个平台加载streamingAssets路径
- unity 在移动平台中,文件操作路径详解
- unity 在移动平台中,文件操作路径详解
- unity 在移动平台中,文件操作路径详解
- unity3d移动平台性能优化(14):渲染路径设置
- unity 在移动平台中,文件操作路径详解
- 【Unity】Unity在移动平台中,文件操作路径详解
- unity 在移动平台中,文件操作路径详解
- 经验传承:谈色彩设计方法
- Windows下配置Apache+Tomcat WEB服务器
- 第二种JavaScript放烟花代码爆炸出图形
- SQL Server 数据库安全
- Combox控件下拉选择不同值触发的动作响应
- 关于移动平台路径
- CK100在win7安装驱动方法
- 按位与按位或
- Java学习笔记之集合框架1
- proguard.ParseException: Unknown option '-keepdirectories' in line 57 of file
- 使用JSON-lib时报There is a cycle in the hierarchy!错误的解决方案
- HDU 1060
- SQL Server 索引和视图
- 安卓4.1: input系统从frameworks到kernel