0
XML 파일에서 텍스트를 읽는 코드가 있는데, 파일이 assetbundles에 추가되었습니다. 파일 하나당 번들이있는 것으로 보입니다.Unity가 assetbundle에 XML을 통합하는 대신 직접 읽어들입니다.
번들을 사용하지 말고 XML 내용을 직접 읽는 것이 좋습니다. 지금 번들을 사용하는 코드는 다음과 같습니다.
foreach(KeyValuePair<string,int> kvp in xmlFileDic)
{
string name = kvp.Key;
string path = xmlBasePath + name + ".assetbundle";
int version = kvp.Value;
WWW www = WWW.LoadFromCacheOrDownload(path,kvp.Value);
yield return www;
AssetBundleRequest ab = www.assetBundle.LoadAsync(name,typeof(TextAsset));
yield return ab;
xmlLoadDic.Add(name,(TextAsset)ab.asset);
www.assetBundle.Unload(false);
...
and reading data
...
string gamerules = FileManagement.xmlLoadDic["GameMasterData"].text;
//string gamerules = www.text;
//Debug.Log("master path:"+masterPath+"game rules:"+gamerules);
System.IO.TextReader reader = new System.IO.StringReader(gamerules);
SmallXmlParser parser = new SmallXmlParser();
MasterDataHandler handler = new MasterDataHandler();
parser.Parse(reader,handler);
mPhaseList = handler.phaseList;
어떻게하면 쉽게 할 수 있습니까?