public static void ToggleEditorMode() { if (AssetBundleConfig.IsSimulateMode) { AssetBundleConfig.IsEditorMode = true; LaunchAssetBundleServer.CheckAndDoRunning(); } }
public static void ToggleSimulateMode() { if (!AssetBundleConfig.IsSimulateMode) { AssetBundleConfig.IsSimulateMode = true; CheckSimulateModelEnv(); LaunchAssetBundleServer.CheckAndDoRunning(); } }
public static void ToggleSimulateMode_UseLuaScripts() { if (!AssetBundleConfig.IsSimulateMode_UseLuaScripts) { AssetBundleConfig.IsSimulateMode_UseLuaScripts = true; CheckSimulateModelEnv(); LaunchAssetBundleServer.CheckAndDoRunning(); } else { AssetBundleConfig.IsSimulateMode_UseLuaScripts = false; CheckSimulateModelEnv(); LaunchAssetBundleServer.CheckAndDoRunning(); } }
static void CheckSimulateModelEnv() { if (!AssetBundleConfig.IsSimulateMode) { return; } var buildTargetName = PackageUtils.GetCurPlatformName(); var channelName = PackageUtils.GetCurSelectedChannel().ToString(); var outputManifest = PackageUtils.GetCurBuildSettingAssetBundleManifestPath(); bool hasBuildAssetBundles = false; if (!File.Exists(outputManifest)) { bool checkBuild = EditorUtility.DisplayDialog("Build AssetBundles Warning", string.Format("Build AssetBundles for : \n\nplatform : {0} \nchannel : {1} \n\nContinue ?", buildTargetName, channelName), "Confirm", "Cancel"); if (!checkBuild) { ToggleEditorMode(); return; } hasBuildAssetBundles = true; BuildPlayer.BuildAssetBundlesForCurSetting(); } var streamingManifest = PackageUtils.GetCurBuildSettingStreamingManifestPath(); if (hasBuildAssetBundles || !File.Exists(streamingManifest)) { bool checkCopy = EditorUtility.DisplayDialog("Copy AssetBundles To StreamingAssets Warning", string.Format("Copy AssetBundles to streamingAssets folder for : \n\nplatform : {0} \nchannel : {1} \n\nContinue ?", buildTargetName, channelName), "Confirm", "Cancel"); if (!checkCopy) { ToggleEditorMode(); return; } // 拷贝到StreamingAssets目录时,相当于执行大版本更新,那么沙盒目录下的数据就作废了 // 真机上会对比这两个目录下的App版本号来删除,编辑器下暴力一点,直接删除 ToolsClearPersistentAssets(); PackageUtils.CopyCurSettingAssetBundlesToStreamingAssets(EditorUserBuildSettings.activeBuildTarget); } LaunchAssetBundleServer.CheckAndDoRunning(); }
static public void ToolsCopyAssetbundlesAndScripts() { { // 删除ab资源 string outputPath = Path.Combine(Application.persistentDataPath, AssetBundleConfig.AssetBundlesFolderName); UtilityGame.SafeDeleteDir(outputPath); } { // 删除LuaScripts资源 string outputPath = Path.Combine(Application.persistentDataPath, AssetBundleConfig.LuaScriptsFolderName); UtilityGame.SafeDeleteDir(outputPath); } PackageUtils.CopyCurSettingAssetBundlesToStreamingAssetsNoRefresh(); PackageUtils.CopyLuaScriptsToStreamingAssets(); AssetDatabase.Refresh(); LaunchAssetBundleServer.CheckAndDoRunning(); }
static void CheckSimulateModelEnv() { if (!AssetBundleConfig.IsSimulateMode) { return; } var buildTargetName = PackageUtils.GetCurPlatformName(); var channelName = PackageUtils.GetCurSelectedChannel().ToString(); var outputManifest = PackageUtils.GetCurBuildSettingOutputManifestPath(); bool hasBuildAssetBundles = false; if (!File.Exists(outputManifest)) { bool checkBuild = EditorUtility.DisplayDialog("Build AssetBundles Warning", string.Format("Build AssetBundles for : \n\nplatform : {0} \nchannel : {1} \n\nContinue ?", buildTargetName, channelName), "Confirm", "Cancel"); if (!checkBuild) { ToggleEditorMode(); return; } hasBuildAssetBundles = true; BuildPlayer.BuildAssetBundlesForCurSetting(); } var streamingManifest = PackageUtils.GetCurBuildSettingStreamingManifestPath(); if (hasBuildAssetBundles || !File.Exists(streamingManifest)) { bool checkCopy = EditorUtility.DisplayDialog("Copy AssetBundles To StreamingAssets Warning", string.Format("Copy AssetBundles to streamingAssets folder for : \n\nplatform : {0} \nchannel : {1} \n\nContinue ?", buildTargetName, channelName), "Confirm", "Cancel"); if (!checkCopy) { ToggleEditorMode(); return; } PackageUtils.CopyCurSettingAssetBundlesToStreamingAssets(); } LaunchAssetBundleServer.CheckAndDoRunning(); }
static public void ToolsCopyAssetbundles() { var buildTargetName = PackageUtils.GetCurPlatformName(); var channelName = PackageUtils.GetCurSelectedChannel().ToString(); bool checkCopy = EditorUtility.DisplayDialog("Copy AssetBundles To StreamingAssets Warning", string.Format("Copy AssetBundles to streamingAssets folder for : \n\nplatform : {0} \nchannel : {1} \n\nContinue ?", buildTargetName, channelName), "Confirm", "Cancel"); if (!checkCopy) { return; } // 拷贝到StreamingAssets目录时,相当于执行大版本更新,那么沙盒目录下的数据就作废了 // 真机上会对比这两个目录下的App版本号来删除,编辑器下暴力一点,直接删除 ToolsClearPersistentAssets(); PackageUtils.CopyCurSettingAssetBundlesToStreamingAssets(); LaunchAssetBundleServer.CheckAndDoRunning(); }
// unity editor启动和运行时调用 static AssetBundleMenuItems() { // 1、模拟模式下在电脑上模拟手机资源更新过程,如果需要更新最新ab,需要手动构建;如果根本没有ab,则构建一次 // 2、模拟模式下需要用到streamingAsset,没有资源则拷贝一次,之后总是从本地服务器下载ab到persistentDataPath var platformName = AssetBundleUtility.GetCurPlatformName(); var outputManifest = Path.Combine(AssetBundleConfig.AssetBundlesBuildOutputPath, platformName); outputManifest = Path.Combine(outputManifest, platformName); if (!File.Exists(outputManifest)) { AssetBundleBuildScript.BuildAssetBundles(); } var streamingManifest = Path.Combine(Application.streamingAssetsPath, AssetBundleConfig.AssetBundlesFolderName); streamingManifest = Path.Combine(streamingManifest, platformName); streamingManifest = Path.Combine(streamingManifest, platformName); if (!File.Exists(streamingManifest)) { AssetBundleUtility.CopyPlatformAssetBundlesToStreamingAssets(); AssetDatabase.Refresh(); } LaunchAssetBundleServer.CheckAndDoRunning(); }
public static void ToggleSimulateMode() { AssetBundleConfig.IsSimulateMode = !AssetBundleConfig.IsSimulateMode; LaunchAssetBundleServer.CheckAndDoRunning(); }