首页 技术 正文
技术 2022年11月14日
0 收藏 855 点赞 2,796 浏览 1571 个字

下载OBB插件包

http://pan.baidu.com/s/1c0ouRZE

1、导入插件

注意事项:

如果项目中已经存在Android 插件,需要merge导入的xml文件例如 AndroidManifest.xml和strings.xml文件,否则编译或运行的时候可能会报错.

2、修改GooglePlayDownloader.cs 文件中的key改成你的key.

3、勾选 Player Settings ->Publishing Settings中的split Application Binary.

4、编译发布

以下是结合Ngui进度条代码示例:

using UnityEngine;
using System.Collections;public class DownLoadObb : MonoBehaviour { private string expPath;
private string logtxt;
private bool alreadyLogged = false; private bool downloadStarted = false;
private string uri;
// private string mainPath; public GameObject downloadButton; public UILabel progress; public UISlider progressBar; void Awake(){ }
void Start(){
if (!GooglePlayDownloader.RunningOnAndroid())
{ return;
} expPath = GooglePlayDownloader.GetExpansionFilePath();
if (expPath == null)
{ return ;
}
else
{
string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath);
// string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath);
if (mainPath == null ){
downloadButton.SetActive(true); }
StartCoroutine(loadLevel());
}
} public void DownLoad(){
GooglePlayDownloader.FetchOBB();
} void Update (){
if(!www.isDone){
progress.text = "Loading data file... "+(www.progress*).ToString("f2")+"%";
progressBar.sliderValue = www.progress;
}
} WWW www;
IEnumerator loadLevel(){
string mainPath;
do{
yield return new WaitForSeconds(0.5f);
mainPath = GooglePlayDownloader.GetMainOBBPath(expPath);
}
while(mainPath == null); progress.gameObject.SetActive(true);
progressBar.gameObject.SetActive(true);
downloadButton.SetActive(false); if(downloadStarted == false){
downloadStarted = true; uri = "file://" + mainPath; www = WWW.LoadFromCacheOrDownload(uri,); yield return www; if(www.error == null){
Application.LoadLevel("Menu");
}
}
}
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,085
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,560
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,409
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,182
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,819
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,902