public static void OnBuildEnd(BuildTarget target, string pathToBuiltProject) { if (!target.Equals(BuildTarget.PSP2)) { return; } if (pathToBuiltProject.Contains("/data/VitaUnity/build")) { CustomPrepBuild(true, pathToBuiltProject); sendCommand("usb disable -"); sendCommand("file ux0:data/VitaUnity/build/build.self"); return; } File.WriteAllText(LastBuildDirSavePath, pathToBuiltProject); if (data == null) { data = JsonUtility.FromJson <UploadWrapper.UploadData>(File.ReadAllText(VitaFTPOptions.SavePath)); } if (!data.startOnBuildEnd) { return; } UnityEngine.Debug.Log("Autorunning"); if (loadData() < 0) { return; } BuildVPK(true); ReplaceInstall(); }
void OnGUI() { EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); { GUILayout.Label(new GUIContent("Build OS : ")); _target = (BuildTarget)EditorGUILayout.EnumPopup(_target); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { GUILayout.Label(new GUIContent("Save Path")); if (GUILayout.Button(new GUIContent("..."))) { string path = EditorUtility.SaveFolderPanel("AssetBundle as Save", "", ""); if (path.Length > 0) { _path = path; } } } EditorGUILayout.EndHorizontal(); _path = EditorGUILayout.TextField(_path); if (GUILayout.Button(new GUIContent("Build"))) { if (_target.Equals(BuildTarget.NoTarget)) { MessageBox.Show("Unity Pie", "Select build target!", new Vector2(320, 70)); return; } StringBuilder sb = new StringBuilder(); sb.Append(_path).Append("/AssetBundles/"); DirectoryInfo info1 = new DirectoryInfo(sb.ToString()); if (!info1.Exists) { info1.Create(); } sb.Append(_target); DirectoryInfo info2 = new DirectoryInfo(sb.ToString()); if (!info2.Exists) { info2.Create(); } BuildPipeline.BuildAssetBundles(sb.ToString(), BuildAssetBundleOptions.None, _target); } EditorGUILayout.EndVertical(); }
static bool RevertBuild () { try { if (!cloudBuild && !debugBuild) { // If this is not a cloud build, revert to the original build target if we saved one earlier if (regularTarget != BuildTarget.NoTarget && regularTargetGroup != BuildTargetGroup.Unknown) { if (!regularTarget.Equals (EditorUserBuildSettings.activeBuildTarget)) { HeadlessAPI.VersionedSwitchActiveBuildTarget (regularTargetGroup, regularTarget); } } } return true; } catch (Exception e) { UnityEngine.Debug.LogError (e); return false; } }
[PostProcessBuild] // <- this is where the magic happens public static void OnPostProcessBuild(BuildTarget target, string path) { if (target.Equals(BuildTarget.WP8Player)) { //locate app.xaml.cs var targetDir = new DirectoryInfo(path); FileInfo appFile = GetUniqueFileByPattern(targetDir, "App.xaml.cs", "App.xaml.cs"); if (appFile == null) { return; } //locate csproj File DirectoryInfo projectDir = appFile.Directory; FileInfo projectFile = GetUniqueFileByPattern(targetDir, "*.csproj", "Project"); if (projectFile == null) { return; } var appAssetsDir = new DirectoryInfo(Application.dataPath); var contentPath = Path.Combine(appAssetsDir.FullName, WP8PluginPath + HockeyAppContentFolderName); if (!Directory.Exists(contentPath)) { Debug.LogWarning("Content directory does not exist: " + contentPath); } else { var originalContentDir = new DirectoryInfo(contentPath); var originalLibDir = new DirectoryInfo(Path.Combine(appAssetsDir.FullName, WP8PluginPath + HockeyAppLibFolderName)); var projectContentDir = new DirectoryInfo(Path.Combine(projectDir.FullName, HockeyAppContentFolderName)); CopyAll(originalContentDir, projectContentDir, "*.png"); //copy HockeyAppContent to Project CopyAll(originalLibDir, projectDir, "*.ha"); MakeChangesToProjectFile(projectFile, originalContentDir.GetFiles("*.png")); } MakeChangesToAppXamlCs(appFile); } }