当前位置:网站首页>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 () {
}
}
边栏推荐
- A5000 vGPU显示模式切换
- Is it difficult for small and micro enterprises to make accounts? Smart accounting gadget quick to use
- 【GET-4】
- POJ3617 Best Cow Line 馋
- Appx代码签名指南
- Tencent Android interview must ask, 10 years of Android development experience
- Anaconda安裝後Jupyter launch 沒反應&網頁打開運行沒執行
- JVM_常见【面试题】
- 【云原生与5G】微服务加持5G核心网
- [network planning] Chapter 3 data link layer (3) channel division medium access control
猜你喜欢
Tencent T2 Daniel explained in person and doubled his job hopping salary
腾讯T2大牛亲自讲解,跳槽薪资翻倍
报错分析~csdn反弹shell报错
深度学习分类网络 -- ZFNet
(3) Web security | penetration testing | basic knowledge of network security construction, IIS website construction, EXE backdoor generation tool quasar, basic use of
The "white paper on the panorama of the digital economy" has been released with great emphasis on the digitalization of insurance
棋盘左上角到右下角方案数(2)
【GET-4】
2022年6月语音合成(TTS)和语音识别(ASR)论文月报
BeagleBoneBlack 上手记
随机推荐
Appx代码签名指南
5. 無線體內納米網:十大“可行嗎?”問題
(3) Web security | penetration testing | basic knowledge of network security construction, IIS website construction, EXE backdoor generation tool quasar, basic use of
Appx code signing Guide
Configuration and simple usage of the EXE backdoor generation tool quasar
【Yann LeCun点赞B站UP主使用Minecraft制作的红石神经网络】
What happened to the kernel after malloc() was transferred? Attached malloc () and free () implementation source
HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother
Cesium 点击绘制圆形(动态绘制圆形)
5. Nano - Net in wireless body: Top 10 "is it possible?" Questions
AsyncHandler
Tencent T3 teaches you hand in hand. It's really delicious
小微企业难做账?智能代账小工具快用起来
New generation garbage collector ZGC
[play with Linux] [docker] MySQL installation and configuration
Anaconda安装后Jupyter launch 没反应&网页打开运行没执行
golang的超时处理使用技巧
Web开发小妙招:巧用ThreadLocal规避层层传值
Node.js: express + MySQL实现注册登录,身份认证
Tencent architects first, 2022 Android interview written examination summary