AssetBundle LoadAssetBundleFile(string assetFile, bool isStreaming) { #if UNITY_ANDROID && !UNITY_EDITOR if (isStreaming) { string path = Application.dataPath + "!assets/" + _streamingPath + assetFile; if (ObbAssetLoad.ExistsFile(_streamingPath + assetFile)) { path = GoogleObbPath.GetMainObbPath() + "/" + _streamingPath + assetFile; } AssetBundle ab = null; try { ab = AssetBundle.LoadFromFile(path); } catch (System.Exception ex) { Debugger.LogException(ex); } if (ab != null) { return(ab); } Debugger.LogError("Read StreamingAssets : " + assetFile + " fail!"); } #endif if (File.Exists(assetFile)) { AssetBundle ab = null; try { ab = AssetBundle.LoadFromFile(assetFile); } catch (System.Exception ex) { Debugger.LogException(ex); } if (ab == null) { Debugger.LogError("The file : " + assetFile + " error!!"); try { File.Delete(assetFile); PlayerPrefs.SetInt("CHECK_RESOURCE", 0); } catch (Exception ex) { Debugger.LogException(ex); } } return(ab); } PlayerPrefs.SetInt("CHECK_RESOURCE", 0); Debugger.LogError("The file : " + assetFile + " not exist!!"); return(null); }
public static Stream GetStreamingFile(string file) { #if UNITY_ANDROID && !UNITY_EDITOR file = _streamingPath + file; if (ObbAssetLoad.ExistsFile(file)) { return(ObbAssetLoad.GetFile(file)); } return(StreamingAssetLoad.GetFile(file)); #endif throw new NotImplementedException(); }