using UnityEngine; using System.Collections; using System.IO; public class DownloadBundleDevice : MonoBehaviour { private static string[] _files =new []{ "default_background", "default_hd" , "default_scenery", "default_sd", "default_shd" }; private static string Platform { get { #if UNITY_ANDROID return "Android"; #endif #if UNITY_IPHONE return "iPhone"; #endif return ""; } } public static void Extract() { var path = Application.persistentDataPath.TrimEnd('/') + "/" + Platform; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } foreach (var file in _files) { var data = Resources.Load(Platform + "/" + file).bytes; var manifest = Resources.Load(Platform + "/" + file + ".bytes").text; File.WriteAllBytes(path + "/" + file + ".unity3d", data); File.WriteAllText(path + "/" + file + ".unity3d.manifest", manifest); Debug.Log("Path " + path); //Debug.Log(path + "/" + file + ".unity3d"); } /*for (int i = 0; i < _files.Length; i++) { }*/ } }