Unity之获取资源包的路径
先从缓存中获取,如果获取不到,则从包中获取。
如下:
public static string GetAssetBundlePath(string path)
{
// 先尝试从 persist 目录加载
if (GameConfig.HotPatching)
{
getPathResult.Length = ;
getPathResult.Append(BundleDownloader.Folder);
getPathResult.Append("/");
getPathResult.Append(path);
tmpPath = getPathResult.ToString();
if (File.Exists(tmpPath))
{
getPathResult.Length = ;
getPathResult.Append("file:///");
getPathResult.Append(BundleDownloader.Folder);
getPathResult.Append("/");
getPathResult.Append(path);
tmpPath = getPathResult.ToString();
return tmpPath;
}
} #if UNITY_EDITOR || UNITY_STANDALONE_WIN
getPathResult.Length = ;
getPathResult.Append("file://");
getPathResult.Append(Application.streamingAssetsPath);
getPathResult.Append("/");
getPathResult.Append(path);
tmpPath = getPathResult.ToString();
#elif UNITY_IOS
getPathResult.Length = ;
getPathResult.Append("file://");
getPathResult.Append(Application.dataPath);
getPathResult.Append("/Raw/");
getPathResult.Append(path);
tmpPath = getPathResult.ToString();
#elif UNITY_ANDROID
getPathResult.Length = ;
getPathResult.Append("jar:file://");
getPathResult.Append(Application.dataPath);
getPathResult.Append("!/assets/");
getPathResult.Append(path);
tmpPath = getPathResult.ToString();
#endif
return tmpPath;
}
转载请注明出处:http://www.cnblogs.com/jietian331/p/8631076.html
Unity之获取资源包的路径的更多相关文章
- Class.getResourceAsStream()与ClassLoader.getResourceAsStream()获取资源时的路径说明
Class.getResourceAsStream(): com.xusweeter.iot.ws.vodafone.config.VodafoneServiceConfig.class.getRes ...
- Unity 已下载工程包存放路径
Mac Finder 中 Shift+Command+G输入后回车 ~/Library/Unity/Asset Store-5.x Windows 么有,自己上别的网站查去~
- 获取 python 包的路径
root@ostack01:~# python Python 2.7. (default, Nov , ::) [GCC 5.4. ] on linux2 Type "help", ...
- wpf 前台获取资源文件路径问题
1 <ImageBrush ImageSource="YT.CM.CommonUI;component/Resource/FloadwindowImage/middle.png&quo ...
- iOS二进制和资源包的自检
因为现在做的是企业版的APP,不能保证用户不越狱,也不能保证有些用户喜欢自己修改ipa包里的资源文件,比如更换一些资源图片.因此,我们有必要在请求报文中,增加正版应用的二进制和资源文件的标识,让服务器 ...
- SpringBoot的配置文件加载顺序以及如何获取jar包里的资源路径
一.读取配置文件的四种方式 这四种配置文件放置方式的读取优先级依次递减,具体可以查看官方文档. 1.1jar包同级目录下的config文件夹里的配置文件 其实我以前就见过这种方式了,只是不知道怎么做的 ...
- Maven项目中获取classpath和资源文件的路径
假设资源文件放在maven工程的 src/main/resources 资源文件夹下,源码文件放在 src/main/java/下, 那么java文件夹和resources文件夹在运行时就是cl ...
- javaWeb项目中的路径格式 请求url地址 客户端路径 服务端路径 url-pattern 路径 获取资源路径 地址 url
javaweb项目中有很多场景的路径客户端的POST/GET请求,服务器的请求转发,资源获取需要设置路径等这些路径表达的含义都有不同,所以想要更好的书写规范有用的路径代码 需要对路径有一个清晰地认知 ...
- springboot jar包运行中获取资源文件
1. 今天晚上写了一个程序,基于Spring boot的一个小网站,发现使用FileUtils.class.getResource(path)来获取jar包中的资源文件并不能成功,其路径很奇怪 fil ...
随机推荐
- centos7配置固定ip
查看本机gateway netstat -rn (以0.0.0.0开始的行的gateway是默认网关) vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 T ...
- 【转】C# 高性能 TCP 服务的多种实现方式
原文链接: http://www.cnblogs.com/gaochundong/p/csharp_tcp_service_models.html 开源库: https://github.com/ga ...
- Windows 安装服务 的两种方式
第一种 - 安装服务时自定义服务名称:(注意 binpath= 和路径之间的那个空格)sc create 服务名称 binpath= "D:\Service.exe" di ...
- Thinkphp5.1 模板路径报错
版本:5.1.24 ,windows环境 报错: 模板文件不存在:template\index\default\index\index.html 1.报错原因:linux/windows 对大 ...
- git报错You are not allowed to force push code to a protected branch on this project
当我们有时候回滚了代码,想强制push到远程仓库的时候, git push origin --force 会报如下错误: You are not allowed to force push code ...
- 查看java内存情况命令
转自:http://boendev.iteye.com/blog/882479 jinfo:可以输出并修改运行时的java 进程的opts. jps:与unix上的ps类似,用来显示本地的java进程 ...
- Python __all__变量用法
Python中一个py文件就是一个模块,“__all__”变量是一个特殊的变量,可以在py文件中,也可以在包的__init__.py中出现. 1.在普通模块中使用时,表示一个模块中允许哪些属性可以被导 ...
- Centos 7 更换yum源
Centos 7 更换源 yum clean all wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/ ...
- mybatis09--自连接一对多查询
查询导师 下面的所有 老师的信息! 创建实体类 和对应的数据库 /** *导师的实体类 */ public class Teacher { private Integer id; private St ...
- Oracle课程档案,第五天
集合操作 desc job_history:改变历史职位 job_history:历史表 vnion:重复值只保留一个 去除重复值 ★★ vnion all: 把所有重复值保留 不去除重复值★★ in ...