private static void PostBuildHook(UnityEditor.BuildTarget buildTarget, string pathToBuildProject) { if (obfuscatedAfterScene == false) { if (noCSharpScripts) { Debug.LogWarning("No obfuscation required because no C# scripts were found"); } else { Debug.LogError("Failed to obfuscate"); } } else { if (monoBehaviourAssetsNeedReverting) { RestoreAssets(); } if (dllsNeedRestoring) { RestoreOriginalDlls(); } } Clear(); }
public static void Execute(UnityEditor.BuildTarget target) { allmat = AssetDatabase.FindAssets("t:Prefab", folders); maxNum = allmat.Length; curNum = 0; _target = target; SavePath = AssetBundleController.GetPlatformPath(_target); for (int i = 0; i < maxNum; i++) { curNum = i; path = AssetDatabase.GUIDToAssetPath(allmat[curNum]); if (path.Contains("3D")) { continue; } Object obj = AssetDatabase.LoadAssetAtPath(path, typeof(Object)); path = SavePath + obj.name; path += ".assetbundle"; Debug.Log(path); BuildPipeline.BuildAssetBundle(obj, null, path, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets | BuildAssetBundleOptions.DeterministicAssetBundle, _target); } EditorUtility.DisplayDialog("", "一键打包", "OK"); //VisualAutuPack win = (VisualAutuPack)EditorWindow.GetWindowWithRect(typeof(VisualAutuPack), new Rect(Screen.width / 2 - 300, Screen.height / 2, 600, 400), true, "打包中"); }
public static void ExportFile(UnityEditor.BuildTarget target, string copyto) { string platform = AssetBundleCtrl_Windows.GetPlatformName(target); string file = System.IO.Path.Combine(Application.dataPath, "AssetBundle/" + platform); var updatalist = file + "/VersionNum/VersionUpdateList.bytes"; if (File.Exists(updatalist) == false) { EditorUtility.DisplayDialog("", updatalist + " 不存在,\n请生成 增量包文件!(第二个按钮)", "OK"); return; } var data = IndexFileData.Create(File.ReadAllBytes(updatalist)); copyto += ("/" + platform); if (Directory.Exists(copyto)) { Directory.Delete(copyto, true); } Directory.CreateDirectory(copyto); //拷贝版本描述文件 File.Copy(Path.Combine(file, "VersionNum/VersionHash.xml"), Path.Combine(copyto, "VersionHash.xml"), true); File.Copy(Path.Combine(file, "VersionNum/VersionUpdateList.bytes"), Path.Combine(copyto, "VersionUpdateList.bytes"), true); foreach (var d in data.dataMap) { File.Copy(Path.Combine(file, d.Value.path), Path.Combine(copyto, d.Value.path), true); } }
public static string GetPlatformPath(UnityEditor.BuildTarget target) { string SavePath = ""; if (target == BuildTarget.Android) { SavePath = "Assets/VersionManager/" + RuntimePlatform.Android.ToString(); } else if (target == BuildTarget.iOS) { SavePath = "Assets/VersionManager/" + RuntimePlatform.IPhonePlayer.ToString(); } else if (target == BuildTarget.StandaloneWindows) { SavePath = "Assets/VersionManager/" + RuntimePlatform.WindowsPlayer.ToString(); } else { Debug.LogError("target invalid"); return(SavePath); } if (Directory.Exists(SavePath) == false) { Directory.CreateDirectory(SavePath); AssetDatabase.Refresh(); } return(SavePath); }
//不同平台的Assetbundle存放路径不同,这个可以根据自己需要修改 public static string GetPlatformPath(UnityEditor.BuildTarget target) { //string SavePath = ""; //switch (target) //{ // case BuildTarget.StandaloneWindows: // case BuildTarget.StandaloneWindows64: // SavePath = "StreamingAssets/"; // break; // case BuildTarget.iOS: // SavePath = "Raw/"; // break; // case BuildTarget.Android: // SavePath = "assets/"; // break; // default: // SavePath = "StreamingAssets/"; // break; //} /** * 这里是为了方便Examples演示用,所以不同平台都放在一个目录,实际开发中可以分开存放,可以避免反复切换平台需要反复打包 * 不过出包的时候需要把输出的AB包贴到游戏调用的统一目录(比如StreamingAssets) */ string SavePath = "StreamingAssets/"; if (Directory.Exists(SavePath) == false) { Directory.CreateDirectory(SavePath); } return(SavePath); }
public static void ExecuteMd5(UnityEditor.BuildTarget target, string md5FilePath) { string platfrom = AssetBundleController.GetPlatformName(target); Execute(platfrom, md5FilePath); AssetDatabase.Refresh(); }
public static void Execute(UnityEditor.BuildTarget target) { string platform = target.ToString(); Execute(platform); AssetDatabase.Refresh(); }
public static void OnPostprocessBuild( UnityEditor.BuildTarget target, string pathToBuiltProject) { if (!UnityEditorInternal.InternalEditorUtility.inBatchMode) { // Only clean up resolver in Batch Mode. return; } if (target == UnityEditor.BuildTarget.Android) { Debug.Log("ARCoreExtensions: Cleaning up Android library dependencies."); string folderPath = Application.dataPath + _dependenciesDirectory; Directory.Delete(folderPath, true); AssetDatabase.Refresh(); AndroidDependenciesHelper.DoPlayServicesResolve(); } else if (target == UnityEditor.BuildTarget.iOS) { foreach (string enabledTemplateFile in _enabledIOSTemplate) { Debug.LogFormat("ARCoreExtensions: Cleaning up {0} in PostprocessBuild.", enabledTemplateFile); IOSSupportHelper.UpdateIOSPodDependencies(false, enabledTemplateFile); } } }
static IEnumerator StartLoadManifest(UnityEditor.BuildTarget target) { string platform = EditorWindw_GenAssetBundle.GetPlatformName(target); string dir = "file:///" + System.IO.Path.Combine(Application.dataPath, "AssetBundle/" + platform) + "AllResources"; WWW www = new WWW(dir); yield return(www); if (!string.IsNullOrEmpty(www.error)) { yield break; } UnityEngine.Object[] obj = www.assetBundle.LoadAllAssets(); m_abmanifest = obj[0] as AssetBundleManifest; if (m_abmanifest != null) { Execute(platform); } www.assetBundle.Unload(true); if (successCallback != null) { successCallback(true); } // JDeBug.Inst.Log("Create Hash File Success"); // EditorUtility.DisplayDialog("", "生成资源Hash文件完成", "OK"); }
internal static void StackPopBuildConfiguration() { UnityEditor.BuildTarget currentTarget = EditorUserBuildSettings.activeBuildTarget; BuildTargetGroup currentGroup = EditorUserBuildSettings.selectedBuildTargetGroup; EditorUserBuildSettings.SwitchActiveBuildTargetAsync(currentGroup, currentTarget); }
private void IncludePlatformSpecificBundles(UnityEditor.BuildTarget target) { var wwisePlatform = AkAssetUtilities.GetWwisePlatformName(target); var addressableSettings = AddressableAssetSettingsDefaultObject.Settings; if (addressableSettings == null) { UnityEngine.Debug.LogWarningFormat("[Addressables] settings file not found.\nPlease go to Menu/Window/Asset Management/Addressables/Groups, then click 'Create Addressables Settings' button."); return; } foreach (var group in addressableSettings.groups) { var include = true; if (group.Name.Contains("WwiseData")) { if (!group.Name.Contains(wwisePlatform) && !group.name.Contains("AddressableSoundbanks")) { include = false; } var bundleSchema = group.GetSchema <BundledAssetGroupSchema>(); if (bundleSchema != null) { bundleSchema.IncludeInBuild = include; } } } }
public void Build(System.Collections.Generic.List <string> scenesToBuild, UnityEditor.BuildTarget buildTarget, UnityEditor.BuildOptions buildOptions) { Console.WriteLine("ios_bundles_for_release PreBuild"); BuilderHelper.BootSceneFilename = "Assets/Scenes/Boot/Boot.unity"; BuilderHelper.BuildOutsidePlayer2(ref scenesToBuild, ref buildTarget, ref buildOptions, this); Console.WriteLine("ios_bundles_for_release PostBuild"); }
public static string GetPlatformName(UnityEditor.BuildTarget target) { string platform = "Windows32/AllResources/"; switch (target) { case BuildTarget.StandaloneWindows: platform = "Windows32/AllResources/"; break; case BuildTarget.StandaloneWindows64: platform = "Windows64/AllResources/"; break; case BuildTarget.iOS: platform = "IOS/AllResources/"; break; case BuildTarget.StandaloneOSXUniversal: platform = "Mac/AllResources/"; break; case BuildTarget.Android: platform = "Android/AllResources/"; break; default: break; } return(platform); }
public static string GetPlatformName(UnityEditor.BuildTarget target) { string platform = "Windows32"; switch (target) { case BuildTarget.StandaloneWindows: platform = "Windows32"; break; case BuildTarget.StandaloneWindows64: platform = "Windows64"; break; case BuildTarget.iOS: platform = "IOS"; break; case BuildTarget.StandaloneOSXIntel: platform = "Mac"; break; case BuildTarget.Android: platform = "Android"; break; default: break; } return(platform); }
private static void CheckCompatibilityWithAllSessionConfigs( ARCoreExtensionsProjectSettings settings, Dictionary <ARCoreExtensionsConfig, string> sessionToSceneMap, UnityEditor.BuildTarget buildTarget) { List <IDependentModule> featureModules = DependentModulesManager.GetModules(); foreach (IDependentModule module in featureModules) { ModuleNecessity moduleNecessity = ModuleNecessity.NotRequired; foreach (var entry in sessionToSceneMap) { ARCoreExtensionsConfig sessionConfig = entry.Key; if (!module.IsCompatible(settings, sessionConfig, buildTarget)) { throw new BuildFailedException( string.Format( "{0} isn't compatible with the ARCoreExtensionsConfig in {1}.", module.GetType().Name, entry.Value)); } moduleNecessity = (ModuleNecessity)Math.Max( (int)moduleNecessity, (int)module.GetModuleNecessity(sessionConfig)); } if (moduleNecessity == ModuleNecessity.NotRequired && module.IsEnabled(settings, buildTarget)) { Debug.LogWarning(module.GetEnabledNotRequiredWarning(settings, buildTarget)); } } }
public static void Execute(UnityEditor.BuildTarget target) { string platform = AssetBundleController.GetPlatformName(target); Execute(platform); AssetDatabase.Refresh(); }
/************************************************************************************************/ static public string GetPlatformFolderForAssetBundles(UnityEditor.BuildTarget target) { switch (target) { case UnityEditor.BuildTarget.Android: return("Android"); case UnityEditor.BuildTarget.iOS: return("IOS"); case UnityEditor.BuildTarget.WebGL: return("WebPlayer"); case UnityEditor.BuildTarget.StandaloneWindows: case UnityEditor.BuildTarget.StandaloneWindows64: return("Windows"); case UnityEditor.BuildTarget.StandaloneOSXIntel: case UnityEditor.BuildTarget.StandaloneOSXIntel64: // case UnityEditor.BuildTarget.StandaloneOSX: return("OSX"); // Add more build targets for your own. // If you add more targets, don't forget to add the same platforms to GetPlatformFolderForAssetBundles(RuntimePlatform) function. default: return(null); } }
public static void Execute(UnityEditor.BuildTarget target) { string platfrom = AssetBundleController.GetPlatformName(target); Execute(platfrom, "StreamingAssets/clientxml2/"); AssetDatabase.Refresh(); }
public static string GetPlatformName(UnityEditor.BuildTarget target) { string platform = "PC"; switch (target) { case BuildTarget.StandaloneWindows: platform = "PC"; break; case BuildTarget.StandaloneWindows64: platform = "PC"; break; case BuildTarget.iPhone: platform = "IOS"; break; case BuildTarget.StandaloneOSXUniversal: platform = "Mac"; break; case BuildTarget.Android: platform = "Android"; break; case BuildTarget.WebPlayer: platform = "WebPlayer"; break; default: break; } return(platform); }
private void CheckConfig(UnityEditor.BuildTarget platform) { Debug.Log("TTPPreProcessSettings::CheckConfig: "); string configurationJson = ((TTPCore.ITTPCoreInternal)TTPCore.Impl).GetConfigurationJson("global"); if (!string.IsNullOrEmpty(configurationJson)) { Debug.Log("TTPPreProcessSettings::CheckConfig: configurationJson=" + configurationJson); Dictionary <string, object> configuration = TTPJson.Deserialize(configurationJson) as Dictionary <string, object>; object storeObj; if (configuration.TryGetValue("store", out storeObj)) { string store = (string)storeObj; Debug.Log("TTPPreProcessSettings::CheckConfig: store=" + store); if (platform == UnityEditor.BuildTarget.iOS && !store.Equals("apple")) { Debug.LogError("Store in global.json does not match current platform:store=" + store + " platform=iOS"); } else if (platform == UnityEditor.BuildTarget.Android && !store.Equals("google")) { Debug.LogError("Store in global.json does not match current platform:store=" + store + " platform=Android"); } } } }
public static void Execute(UnityEditor.BuildTarget target) { string SavePath = BuildPipelinePanel.GetPlatformReleasePath(target); // 当前选中的资源列表 foreach (Object o in Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets)) { string path = AssetDatabase.GetAssetPath(o); //string [] levels = {path}; // 过滤掉meta文件和文件夹 if (path.Contains(".meta") || path.Contains(".") == false) { continue; } // 过滤掉UIAtlas目录下的贴图和材质(UI/Common目录下的所有资源都是UIAtlas) if (path.Contains("UI/Common")) { if ((o is Texture) || (o is Material)) { continue; } } path = SavePath + ConvertToAssetBundleName(path); path = path.Substring(0, path.LastIndexOf('.')); path += ".assetbundle"; //打包场景 //BuildPipeline.BuildStreamedSceneAssetBundle (levels, path, target, BuildOptions.UncompressedAssetBundle); } // scene目录下的资源 AssetDatabase.Refresh(); }
public static void CompressVersionXml(UnityEditor.BuildTarget target) { string SavePath = PlatformMap.GetPlatformPath(target); CompressFileLZMA(SavePath + "/" + GenAllUpdateVersionXml.strVFile + ".xml", SavePath + "/" + GenAllUpdateVersionXml.strVFile + ".zip"); AssetDatabase.Refresh(); return; }
public static void Execute(UnityEditor.BuildTarget target) { // 获取平台标识 比如 IOS 、Mac string platform = AssetBundlesCreatorEx.GetPlatformName(target); Execute(platform); AssetDatabase.Refresh(); }
public static void ExecuteMac() { if (window == null) { window = (AssetBundleController)GetWindow(typeof(AssetBundleController)); } buildTarget = UnityEditor.BuildTarget.StandaloneOSXUniversal; window.Show(); }
// [MenuItem("AssetBundle Tools/AssetBundle/AssetBundle For WP", false, 6)] public static void ExecuteWinPhone() { buildTarget = UnityEditor.BuildTarget.WP8Player; if (CheckPlatform(buildTarget)) { checkWindow(); window.Show(); } }
public static void ExecuteWebPlayer() { if (window == null) { window = (AssetBundleController)GetWindow(typeof(AssetBundleController)); } buildTarget = UnityEditor.BuildTarget.WebPlayer; window.Show(); }
// [MenuItem("AssetBundle Tools/AssetBundle/AssetBundle For Mac", false, 3)] public static void ExecuteMac() { buildTarget = UnityEditor.BuildTarget.StandaloneOSXIntel; if (CheckPlatform(buildTarget)) { checkWindow(); window.Show(); } }
// [MenuItem("AssetBundle Tools/AssetBundle/AssetBundle For Android", false, 4)] public static void ExecuteAndroid() { buildTarget = UnityEditor.BuildTarget.Android; if (CheckPlatform(buildTarget)) { checkWindow(); window.Show(); } }
public void Build(System.Collections.Generic.List <string> scenesToBuild, UnityEditor.BuildTarget buildTarget, UnityEditor.BuildOptions buildOptions) { Console.WriteLine("ios PreBuild"); BuilderHelper.BootSceneFilename = "Assets/Scenes/Boot/Boot.unity"; BuilderHelper.BuildInsidePlayer(ref scenesToBuild, ref buildTarget, ref buildOptions, this); InJoy.UnityBuildSystem.AutoBuild.UnityBuildPlayer(scenesToBuild, buildTarget, buildOptions); AssetBundlesFtp.GenerateIndexSizeMapToFile("assetBundlesSizeFile.txt"); Console.WriteLine("ios PostBuild"); }
public static void Execute(UnityEditor.BuildTarget target) { string SavePath = AssetBundlesCreatorEx.GetPlatformPath(target); Object obj = AssetDatabase.LoadAssetAtPath(SavePath + "VersionNum/VersionNum.xml", typeof(Object)); BuildPipeline.BuildAssetBundle(obj, null, SavePath + "VersionNum/VersionNum.assetbundle", BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets | BuildAssetBundleOptions.DeterministicAssetBundle, target); AssetDatabase.Refresh(); }