unity 使用 www 方法,加载 并生成 一个 unity打包好 的 .prefab预制体物体的FGUI的AssetBundle。
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;//www
public class ABRead : MonoBehaviour
{
string dirPath = "E:/test/AssetBundles/android1/prefab/testgo";//Application.streamingAssetsPath + "/AB/tests/tests.ab";
// Start is called before the first frame update
void Start()
{
StartCoroutine(UnityWebRequestLoadAB2(dirPath, (ab) =>
{
//实例化
GameObject obj = ab.LoadAsset<GameObject>("testgo");//名字为testgo的预制体,只含有FGUI的uiplane脚本,并且uiplane设置好packageName和ComponentName
Instantiate(obj);
}));
}
IEnumerator UnityWebRequestLoadAB2(string uriPath, Action<AssetBundle> loadABFinishedAction)
{
UnityWebRequest request = Unity