同步读取各平台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)

原文地址:https://www.cnblogs.com/zouqiang/p/6497050.html