当前位置:网站首页>Unity load AB package
Unity load AB package
2022-07-06 20:13:00 【LiPing122335】
Load asynchronously
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;
public class LaodAB : MonoBehaviour {
// Use this for initialization
void Start () {
StartCoroutine("LoadWed");
//LoadFile();
}
void LoadFile()
{// Local
AssetBundle ab = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "my2"));
GameObject go = ab.LoadAsset<GameObject>("Cube");
GameObject g = Instantiate(go);
//g.transform.SetParent(GameObject.Find("Canvas").transform, false);
}
IEnumerator LoadWed()
{
string uri = "file:///" + Application.dataPath + "/StreamingAssets/my2";
UnityWebRequest request = UnityWebRequest.GetAssetBundle(uri);
yield return request.Send();
AssetBundle ab = DownloadHandlerAssetBundle.GetContent(request);
//AssetBundle ab = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "my2"));
GameObject go = ab.LoadAsset<GameObject>("Cube");
GameObject g = Instantiate(go);
}
void Update () {
}
}
边栏推荐
- 爬虫(14) - Scrapy-Redis分布式爬虫(1) | 详解
- Introduction to enterprise lean management system
- 【云原生与5G】微服务加持5G核心网
- Node.js: express + MySQL实现注册登录,身份认证
- Poj1149 pigs [maximum flow]
- Method keywords deprecated, externalprocname, final, forcegenerate
- AsyncHandler
- logstash高速入口
- How to handle the timeout of golang
- 腾讯T4架构师,android面试基础
猜你喜欢

棋盘左上角到右下角方案数(2)

【Yann LeCun点赞B站UP主使用Minecraft制作的红石神经网络】

BUUCTF---Reverse---easyre
Tencent T4 architect, Android interview Foundation

01 基础入门-概念名词
![[calculating emotion and thought] floor sweeper, typist, information panic and Oppenheimer](/img/8c/afb90128e7a523bbee4c6c4166363f.png)
[calculating emotion and thought] floor sweeper, typist, information panic and Oppenheimer

5. Wireless in vivo nano network: top ten "feasible?" problem

Example of shutter text component
腾讯字节等大厂面试真题汇总,网易架构师深入讲解Android开发

Le lancement du jupyter ne répond pas après l'installation d'Anaconda
随机推荐
永磁同步电机转子位置估算专题 —— 基波模型类位置估算概要
腾讯字节等大厂面试真题汇总,网易架构师深入讲解Android开发
Microservice architecture debate between radical technologists vs Project conservatives
永磁同步电机转子位置估算专题 —— 基波模型与转子位置角
Information System Project Manager - Chapter VIII project quality management
Crawler (14) - scrape redis distributed crawler (1) | detailed explanation
golang的超时处理使用技巧
【云小课】EI第47课 MRS离线数据分析-通过Flink作业处理OBS数据
AsyncHandler
Cesium 点击绘制圆形(动态绘制圆形)
[Yann Lecun likes the red stone neural network made by minecraft]
Web开发小妙招:巧用ThreadLocal规避层层传值
Qinglong panel white screen one key repair
Linear distance between two points of cesium
Finally, there is no need to change a line of code! Shardingsphere native driver comes out
Introduction of Xia Zhigang
beegfs高可用模式探讨
腾讯T3大牛手把手教你,大厂内部资料
Classic 100 questions of algorithm interview, the latest career planning of Android programmers
PHP与EXCEL PHPExcel