当前位置:网站首页>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 () {
}
}
边栏推荐
- js获取浏览器系统语言
- JVM_ Common [interview questions]
- Technology sharing | packet capturing analysis TCP protocol
- Qinglong panel white screen one key repair
- Oceanbase Community Edition OBD mode deployment mode stand-alone installation
- redisson bug分析
- 棋盘左上角到右下角方案数(2)
- Enumeration gets values based on parameters
- 某东短信登录复活 安装部署教程
- 【云原生与5G】微服务加持5G核心网
猜你喜欢
Cesium Click to draw a circle (dynamically draw a circle)
Introduction of Xia Zhigang
Tencent T2 Daniel explained in person and doubled his job hopping salary
PowerPivot——DAX(初识)
In simple terms, interview surprise Edition
腾讯T2大牛亲自讲解,跳槽薪资翻倍
Tencent T3 teaches you hand in hand. It's really delicious
Case ① | host security construction: best practice of 3 levels and 11 capabilities
Special topic of rotor position estimation of permanent magnet synchronous motor -- fundamental wave model and rotor position angle
22-07-05 七牛云存储图片、用户头像上传
随机推荐
HMS Core 机器学习服务打造同传翻译新“声”态,AI让国际交流更顺畅
转让malloc()该功能后,发生了什么事内核?附malloc()和free()实现源
腾讯架构师首发,2022Android面试笔试总结
Speech recognition (ASR) paper selection: talcs: an open source Mandarin English code switching corps and a speech
腾讯T3大牛手把手教你,大厂内部资料
Introduction of Xia Zhigang
Node. Js: express + MySQL realizes registration, login and identity authentication
Vscode debug run fluent message: there is no extension for debugging yaml. Should we find yaml extensions in the market?
SSH connection denied
技术分享 | 抓包分析 TCP 协议
8086 instruction code summary (table)
Microservice architecture debate between radical technologists vs Project conservatives
Le lancement du jupyter ne répond pas après l'installation d'Anaconda
Appx code signing Guide
Problems encountered in using RT thread component fish
青龙面板白屏一键修复
永磁同步电机转子位置估算专题 —— 基波模型与转子位置角
永磁同步电机转子位置估算专题 —— 基波模型类位置估算概要
枚举根据参数获取值
爬虫(14) - Scrapy-Redis分布式爬虫(1) | 详解