当前位置:网站首页>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 () {
}
}
边栏推荐
- Deep learning classification network -- zfnet
- 腾讯字节阿里小米京东大厂Offer拿到手软,老师讲的真棒
- AsyncHandler
- Cesium 两点之间的直线距离
- Recursive implementation of department tree
- OceanBase社区版之OBD方式部署方式单机安装
- String长度限制?
- The "white paper on the panorama of the digital economy" has been released with great emphasis on the digitalization of insurance
- Leetcode brush first_ Maximum Subarray
- 02 基础入门-数据包拓展
猜你喜欢
After solving 2961 user feedback, I made such a change
【云原生与5G】微服务加持5G核心网
Classic 100 questions of algorithm interview, the latest career planning of Android programmers
报错分析~csdn反弹shell报错
22-07-05 upload of qiniu cloud storage pictures and user avatars
In simple terms, interview surprise Edition
Case ① | host security construction: best practice of 3 levels and 11 capabilities
BeagleBoneBlack 上手记
腾讯T2大牛亲自讲解,跳槽薪资翻倍
Enumeration gets values based on parameters
随机推荐
Example of applying fonts to flutter
beegfs高可用模式探讨
Alibaba data source Druid visual monitoring configuration
POJ1149 PIGS 【最大流量】
Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
Introduction of Xia Zhigang
Social recruitment interview experience, 2022 latest Android high-frequency selected interview questions sharing
Period compression filter
Linear distance between two points of cesium
POJ 3207 Ikki&#39;s Story IV – Panda&#39;s Trick (2-SAT)
Cesium 两点之间的直线距离
Information System Project Manager - Chapter VIII project quality management
精彩编码 【进制转换】
golang的超时处理使用技巧
Vscode debug run fluent message: there is no extension for debugging yaml. Should we find yaml extensions in the market?
String长度限制?
Deep learning classification network -- zfnet
爬虫(14) - Scrapy-Redis分布式爬虫(1) | 详解
Web开发小妙招:巧用ThreadLocal规避层层传值
Selenium advanced operations