using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
public class sample : MonoBehaviour
{
void Start()
{
var cache = LoadAssetBundle("csvconfig.assetbundle", "CsvConfig");
while (cache.MoveNext()) { }//执行到结束
//显示字典内容
foreach (var dict in cache.Current as Dictionary<string, TextReader>)
{
Debug.Log(dict.Key);
}
}
#region 加载资源协程
static IEnumerator LoadAssetBundle(string abName, string keyword)
{
var cache = new Dictionary<string, TextReader>();
var wwwPath = string.Empty;
#if UNITY_EDITOR_WIN
wwwPath = string.Format("file://{0}/", Application.streamingAssetsPath);
#else
wwwPath = string.Format("jar:file://{0}!/assets/", Application.dataPath);
#endif
var loader = new WWW(wwwPath + abName);
yield
加载assetbundle协程并获取返回参数的程序举例
最新推荐文章于 2024-03-12 12:04:58 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)