同步读取各平台StreamingAssets文件

  //Path为StreamingAssets文件后面的路径
public AssetBundle GetstreamingAssets(string Path) { #if UNITY_EDITOR Path = Application.streamingAssetsPath + "/" + Path; #elif UNITY_IOS Path = Application.dataPath + "!assets/" + Path; #elif UNITY_IOS Path = Application.dataPath + "/Raw/" + Path; #endif Debug.Log("Path : " + Path); AssetBundle assetbundle = AssetBundle.LoadFromFile(Path); return assetbundle; }

 注意的几点

1.只能读取AssetBundle 文件

2.打包资源文件前先设置

File->Build Settings ->Android->Player Settings ->Other Settings ->Write Access 选项为External(SDCard)

posted @ 2017-03-03 15:50  邹强  阅读(489)  评论(0编辑  收藏  举报