当前位置:网站首页>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 () {
}
}
边栏推荐
- Speech recognition (ASR) paper selection: talcs: an open source Mandarin English code switching corps and a speech
- Tencent T2 Daniel explained in person and doubled his job hopping salary
- Tencent Android development interview, basic knowledge of Android Development
- AddressSanitizer 技术初体验
- 微信小程序常用集合
- BeagleBoneBlack 上手记
- Database specific interpretation of paradigm
- 【计网】第三章 数据链路层(4)局域网、以太网、无线局域网、VLAN
- Social recruitment interview experience, 2022 latest Android high-frequency selected interview questions sharing
- Selenium advanced operations
猜你喜欢

腾讯T3手把手教你,真的太香了
腾讯架构师首发,2022Android面试笔试总结

Monthly report of speech synthesis (TTS) and speech recognition (ASR) papers in June 2022

(3) Web security | penetration testing | basic knowledge of network security construction, IIS website construction, EXE backdoor generation tool quasar, basic use of

5. 無線體內納米網:十大“可行嗎?”問題

rt-thread i2c 使用教程
Tencent T2 Daniel explained in person and doubled his job hopping salary

Jupyter launch didn't respond after Anaconda was installed & the web page was opened and ran without execution

Cesium 点击绘制圆形(动态绘制圆形)

Pay attention to the partners on the recruitment website of fishing! The monitoring system may have set you as "high risk of leaving"
随机推荐
Standardized QCI characteristics
Problems encountered in using RT thread component fish
棋盘左上角到右下角方案数(2)
爬虫(14) - Scrapy-Redis分布式爬虫(1) | 详解
The "white paper on the panorama of the digital economy" has been released with great emphasis on the digitalization of insurance
(3) Web security | penetration testing | basic knowledge of network security construction, IIS website construction, EXE backdoor generation tool quasar, basic use of
某东短信登录复活 安装部署教程
A5000 vgpu display mode switching
Introduction of Xia Zhigang
Logstash expressway entrance
深度学习分类网络 -- ZFNet
02 基础入门-数据包拓展
redisson bug分析
beegfs高可用模式探讨
Poj3617 best cow line
HDU 1026 Ignatius and the Princess I 迷宫范围内的搜索剪枝问题
22-07-05 upload of qiniu cloud storage pictures and user avatars
Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
New generation garbage collector ZGC
PowerPivot - DAX (first time)