public static AssetsInitRequest Initialize() { var instance = FindObjectOfType <Assets>(); if (instance == null) { instance = new GameObject("Assets").AddComponent <Assets>(); DontDestroyOnLoad(instance.gameObject); } Log(string.Format("Initialize->assetBundleMode {0}", Assets.assetBundleMode)); var protocal = string.Empty; if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsEditor) { protocal = "file://"; } else if (Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.WindowsPlayer) { protocal = "file:///"; } if (string.IsNullOrEmpty(dataPath)) { dataPath = Application.streamingAssetsPath; } platform = getPlatformDelegate != null?getPlatformDelegate() : GetPlatformForAssetBundles(Application.platform); var assetBundlePlatform = Path.Combine(AssetBundles, platform); assetBundleDataPath = Path.Combine(dataPath, assetBundlePlatform) + Path.DirectorySeparatorChar; assetBundleDataPathURL = protocal + assetBundleDataPath; updatePath = Path.Combine(Application.persistentDataPath, assetBundlePlatform) + Path.DirectorySeparatorChar; OverrideBaseDownloadingUrl += Bundles_overrideBaseDownloadingURL; Versions.Load(); var request = new AssetsInitRequest(); request.url = "AssetsInitRequest"; AddAssetRequest(request); return(request); }
internal static void Init(Manifest manifest) { _bundleAssets.Clear(); OverrideBaseDownloadingUrl += Bundles_overrideBaseDownloadingURL; downloadURL = Path.Combine(manifest.downloadURL, platform) + Path.DirectorySeparatorChar; activeVariants = manifest.activeVariants; _bundleNames = manifest.bundles; var dirs = manifest.dirs; for (int i = 0, max = manifest.assets.Length; i < max; i++) { var item = manifest.assets[i]; _bundleAssets[string.Format("{0}/{1}", dirs[item.dir], item.name)] = item.bundle; } }