private void OnDrawOutputInformations() { m_showOutputInformations = EditorGUILayout.Foldout(m_showOutputInformations, "Output Informations"); if (!m_showOutputInformations) { return; } int indent = EditorGUI.indentLevel; EditorGUI.indentLevel = 1; m_buildTarget = EditorUserBuildSettings.activeBuildTarget; EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Active Build Target"); EditorGUILayout.LabelField(m_buildTarget.ToString()); EditorGUILayout.EndHorizontal(); m_outputPath = AssetBundleDef.GetDefaultOutputPath(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Output Path"); EditorGUILayout.LabelField(m_outputPath); EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel = indent; EditorGUILayout.Space(); }
private static bool SwitchLoadModeToNetworkValidate() { AssetBundleLoadType assetBundleLoadType = AssetBundleDef.GetAssetBundleLoadType(); Menu.SetChecked(ASSETBUNDLE_EDITOR_LOAD_TYPE_NETWORK, assetBundleLoadType == AssetBundleLoadType.Network); return(assetBundleLoadType != AssetBundleLoadType.Network); }
private static bool SwitchLoadModeToStreamingValidate() { AssetBundleLoadType assetBundleLoadType = AssetBundleDef.GetAssetBundleLoadType(); Menu.SetChecked(ASSETBUNDLE_EDITOR_LOAD_TYPE_STREAMING, assetBundleLoadType == AssetBundleLoadType.Streaming); return(assetBundleLoadType != AssetBundleLoadType.Streaming); }
private static bool SwitchLoadModeToSimulateValidate() { AssetBundleLoadType assetBundleLoadType = AssetBundleDef.GetAssetBundleLoadType(); Menu.SetChecked(ASSETBUNDLE_EDITOR_LOAD_TYPE_SIMULATE, assetBundleLoadType == AssetBundleLoadType.Simulate); return(assetBundleLoadType != AssetBundleLoadType.Simulate); }
private IEnumerator PreInitialize(string relativePath) { string platformName = AssetBundleDef.GetPlatformName(); m_downloadingURL = string.Format("{0}/{1}/", relativePath, platformName); JSLDebug.LogFormat("[AssetBundleManager] - The AssetBundle Download URL is {0}", m_downloadingURL); m_loadFromFileURL = string.Format("{0}/{1}/", AssetBundleDef.GetStreamingAssetsPath(), platformName); JSLDebug.LogFormat("[AssetBundleManager] - The AssetBundle LoadFromFile URL is {0}", m_loadFromFileURL); yield return(StartCoroutine(LoadCatalogFromNetwork())); if (m_assetBundleCatalogs == null) { if (m_onInitializeFinish != null) { m_onInitializeFinish(false); m_onInitializeFinish = null; yield break; } } AssetBundleLoadManifestRequest assetBundleLoadManifestRequest = InitializeManifest(platformName); if (assetBundleLoadManifestRequest != null) { yield return(assetBundleLoadManifestRequest); } }
public void Initialize(AssetBundleInitializeData initializeData) { m_maxDownloadRequest = initializeData.maxDownloadRequestAmount; m_onInitializeFinish = initializeData.onInitializeFinish; m_assetBundleLoadType = initializeData.assetBundleLoadType; JSLDebug.LogFormat("[AssetBundleManager] - Initialize with load type '{0}'", m_assetBundleLoadType); if (m_assetBundleLoadType == AssetBundleLoadType.Streaming) { initializeData.downloadURL = AssetBundleDef.GetDownloadStreamingAssetsPath(); } if (m_assetBundleLoadType != AssetBundleLoadType.Simulate) { StartCoroutine(PreInitialize(initializeData.downloadURL)); } else { if (m_onInitializeFinish != null) { m_onInitializeFinish(true); m_onInitializeFinish = null; } } }
public AssetBundleBuildInfo(bool cleanFolders, bool copyToStreamingAssets, BuildAssetBundleOptions buildAssetBundleOptions, AssetBundleBuild[] specificAssetBundles = null) { outputPath = AssetBundleDef.GetDefaultOutputPath(); buildTarget = EditorUserBuildSettings.activeBuildTarget; this.cleanFolders = cleanFolders; this.copyToStreamingAssets = copyToStreamingAssets; this.buildAssetBundleOptions = buildAssetBundleOptions; this.specificAssetBundles = specificAssetBundles; }
public static void Build(AssetBundleBuildInfo buildInfo) { AssetBundleNameBuilder.Build(); AssetDatabase.Refresh(); AssetDatabase.RemoveUnusedAssetBundleNames(); if (buildInfo.cleanFolders) { if (Directory.Exists(buildInfo.outputPath)) { Directory.Delete(buildInfo.outputPath, true); } } if (!Directory.Exists(buildInfo.outputPath)) { Directory.CreateDirectory(buildInfo.outputPath); } if (buildInfo.specificAssetBundles == null || buildInfo.specificAssetBundles.Length == 0) { BuildPipeline.BuildAssetBundles(buildInfo.outputPath, buildInfo.buildAssetBundleOptions, buildInfo.buildTarget); } else { BuildPipeline.BuildAssetBundles(buildInfo.outputPath, buildInfo.specificAssetBundles, buildInfo.buildAssetBundleOptions, buildInfo.buildTarget); } AssetBundleCatalogBuilder.Build(buildInfo.outputPath); if (buildInfo.copyToStreamingAssets) { string streamingAssetsPath = Path.Combine(Application.streamingAssetsPath, AssetBundleDef.ASSET_BUNDLE_OUTPUT_FOLDER); streamingAssetsPath = Path.Combine(streamingAssetsPath, AssetBundleDef.GetPlatformName()); if (Directory.Exists(streamingAssetsPath)) { Directory.Delete(streamingAssetsPath, true); } DirectoryCopy(buildInfo.outputPath, streamingAssetsPath); } AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); JSLDebug.Log("Build AssetBundles successfully."); }
private AssetBundleLoadManifestRequest InitializeManifest(string path) { UnloadAssetBundles(new List <string> { AssetBundleDef.GetPlatformName() }); JSLDebug.LogFormat("[AssetBundleManager] - Start download AssetBundleManifest at frame {0}", Time.frameCount); DownloadAssetBundle(path, true); AssetBundleLoadManifestRequest assetBundleLoadManifestRequest = new AssetBundleLoadManifestRequest(path, "AssetBundleManifest"); m_inProgressRequests.Add(assetBundleLoadManifestRequest); return(assetBundleLoadManifestRequest); }
private static void SwitchLoadModeToNetwork() { AssetBundleDef.SetAssetBundleLoadType(AssetBundleLoadType.Network); }
private static void SwitchLoadModeToStreaming() { AssetBundleDef.SetAssetBundleLoadType(AssetBundleLoadType.Streaming); }
private static void SwitchLoadModeToSimulate() { AssetBundleDef.SetAssetBundleLoadType(AssetBundleLoadType.Simulate); }