public bool Load(string bundleName) { this.Begin(); string bundlePath = AssetPath.LocalBundlePath(bundleName); byte[] data = XFile.ReadBytesFile(bundlePath); Autarky.Signature sig_v3; if (Autarky.Load(ref data, out sig_v3)) { try { this.bundle = AssetBundle.LoadFromMemory(data); this.done = true; return(true); } catch (System.Exception e) { this.error = e.Message; this.done = true; return(false); } } else { this.error = Autarky.error; this.done = true; return(false); } }
public static byte[] ReadBytesFromStreamingAssets(string location) { Debug.Log("Read bytes from StreamingAssets : " + location); location = string.Format("{0}/{1}", Application.streamingAssetsPath, location); if (Application.platform == RuntimePlatform.Android) { WWW www = new WWW(location); while (!www.isDone) { ; } if (!string.IsNullOrEmpty(www.error)) { Debug.LogError("Read bytes from StreamingAssets failed. location=" + location); Debug.LogError(www.error); return(null); } return(www.bytes); } return(XFile.ReadBytesFile(location)); }