123456789101112131415161718192021 |
- using System.Collections;
- using UnityEngine;
- public class LoadResources : MonoBehaviour
- {
- // Start is called before the first frame update
- IEnumerator Start()
- {
- string path = "Assets/AssetsBundles/prefabs/Cube";
- AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(path);
- yield return request;//µÈ´ýÏìÓ¦
- AssetBundle ab = request.assetBundle;
- AssetBundleCreateRequest re = AssetBundle.LoadFromFileAsync("Assets/AssetsBundles/share");
- AssetBundle share = re.assetBundle;
- GameObject[] objs = ab.LoadAllAssets<GameObject>();
- foreach (var item in objs)
- {
- Instantiate(item);
- }
- }
- }
|