当前位置:网站首页>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 () {
}
}
边栏推荐
- Tencent architects first, 2022 Android interview written examination summary
- 永磁同步电机转子位置估算专题 —— 基波模型类位置估算概要
- 使用ssh连接被拒
- Configuration and simple usage of the EXE backdoor generation tool quasar
- New generation garbage collector ZGC
- JS get browser system language
- golang的超时处理使用技巧
- OceanBase社区版之OBD方式部署方式单机安装
- A5000 vgpu display mode switching
- Alibaba数据源Druid可视化监控配置
猜你喜欢
5. Nano - Net in wireless body: Top 10 "is it possible?" Questions
The "white paper on the panorama of the digital economy" has been released with great emphasis on the digitalization of insurance
Tencent Android development interview, basic knowledge of Android Development
Tencent T3 teaches you hand in hand. It's really delicious
5. 無線體內納米網:十大“可行嗎?”問題
Configuration and simple usage of the EXE backdoor generation tool quasar
redisson bug分析
Ideas and methods of system and application monitoring
After solving 2961 user feedback, I made such a change
Redisson bug analysis
随机推荐
精彩编码 【进制转换】
数据的同步为每个站点创建触发器同步表
Speech recognition (ASR) paper selection: talcs: an open source Mandarin English code switching corps and a speech
Cesium 点击绘制圆形(动态绘制圆形)
棋盘左上角到右下角方案数(2)
技术分享 | 抓包分析 TCP 协议
[Yann Lecun likes the red stone neural network made by minecraft]
腾讯字节等大厂面试真题汇总,网易架构师深入讲解Android开发
【计网】第三章 数据链路层(4)局域网、以太网、无线局域网、VLAN
The "white paper on the panorama of the digital economy" has been released with great emphasis on the digitalization of insurance
使用ssh连接被拒
Tencent byte Alibaba Xiaomi jd.com offer got a soft hand, and the teacher said it was great
Node.js: express + MySQL实现注册登录,身份认证
Tencent architects first, 2022 Android interview written examination summary
Recursive implementation of department tree
Example of shutter text component
Tencent T4 architect, Android interview Foundation
5. Wireless in vivo nano network: top ten "feasible?" problem
Special topic of rotor position estimation of permanent magnet synchronous motor -- Summary of position estimation of fundamental wave model
广州首个数据安全峰会将在白云区开幕