private void drawVRSectionGUI(BuildSetupEntry b) { #if UNITY_2017_2_OR_NEWER var targetGroup = BuildPipeline.GetBuildTargetGroup(b.target); if (VRUtils.targetGroupSupportsVirtualReality(targetGroup)) { b.supportsVR = EditorGUILayout.Toggle("VR Support", b.supportsVR); if (b.supportsVR) { b.guiShowVROptions = EditorGUILayout.Foldout(b.guiShowVROptions, "VR Options"); if (b.guiShowVROptions) { EditorGUI.indentLevel++; var vrSdks = VRUtils.getAvailableVRSdks(targetGroup); if (vrSdks.Length > 0) { b.vrSdkFlags = EditorGUILayout.MaskField("VR SDKs", b.vrSdkFlags, vrSdks); } else { GUILayout.Label("No VR SDK available for the current build target."); } EditorGUI.indentLevel--; } } } #endif }
public void duplicateBuildSetupEntry(BuildSetupEntry entry) { var index = entriesList.IndexOf(entry); BuildSetupEntry buildEntry = BuildSetupEntry.Clone(entry); buildEntry.buildName = buildEntry.buildName + "_clone"; entriesList.Insert(index + 1, buildEntry); }
private void drawScenesSectionGUI(BuildSetupEntry b) { b.useDefaultBuildScenes = EditorGUILayout.Toggle("Use Default Build Scenes", b.useDefaultBuildScenes); if (!b.useDefaultBuildScenes) { b.guiShowCustomScenes = EditorGUILayout.Foldout(b.guiShowCustomScenes, "Custom Scenes"); if (b.guiShowCustomScenes) { EditorGUI.indentLevel++; if (b.customScenes.Count > 0) { var scenes = b.customScenes; for (int i = 0; i < scenes.Count; i++) { GUILayout.BeginHorizontal(); scenes[i] = EditorGUILayout.TextField("Scene " + i, scenes[i]); if (GUILayout.Button("Select Scene", GUILayout.ExpandWidth(false))) { string absPath = EditorUtility.OpenFilePanel("Select Scene file", "", "unity"); if (absPath.StartsWith(Application.dataPath)) { string relPath = absPath.Substring(Application.dataPath.Length - "Assets".Length); scenes[i] = relPath; } } if (GUILayout.Button("Remove Scene", GUILayout.ExpandWidth(false))) { Undo.RecordObject(buildSetup, "Remove Build Setup Entry Custom scene"); b.customScenes.RemoveAt(i); i--; } GUILayout.EndHorizontal(); } } using (var horizontalScope = new GUILayout.HorizontalScope()) { GUILayout.Space(20f); if (GUILayout.Button("Add Scene", GUILayout.ExpandWidth(false))) { Undo.RecordObject(buildSetup, "Add Build Setup Entry Custom scene"); b.customScenes.Add(string.Empty); } } EditorGUI.indentLevel--; } } }
public void rearrangeBuildSetupEntry(BuildSetupEntry entry, bool up) { var oldIndex = entriesList.IndexOf(entry); var newIndex = up ? oldIndex - 1 : oldIndex + 1; if (newIndex >= 0 && newIndex < entriesList.Count) { var otherEntry = entriesList[newIndex]; entriesList[newIndex] = entry; entriesList[oldIndex] = otherEntry; } }
public void addBuildSetupEntry() { BuildSetupEntry buildEntry = new BuildSetupEntry(); var currentBuildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup; buildEntry.buildName = Application.productName; buildEntry.target = EditorUserBuildSettings.activeBuildTarget; buildEntry.customScenes = new List <string>(); buildEntry.scriptingBackend = PlayerSettings.GetScriptingBackend(currentBuildTargetGroup); entriesList.Add(buildEntry); }
private void drawBuildEntryGUI(BuildSetupEntry b) { b.buildName = EditorGUILayout.TextField("Build Name", b.buildName); b.target = (BuildTarget)EditorGUILayout.EnumPopup("Target", b.target); if (b.target > 0) { b.debugBuild = EditorGUILayout.Toggle("Debug Build", b.debugBuild); b.scriptingDefineSymbols = EditorGUILayout.TextField("Scripting Define Symbols", b.scriptingDefineSymbols); drawScenesSectionGUI(b); drawAdvancedOptionsSectionGUI(b); drawVRSectionGUI(b); } }
private void drawAdvancedOptionsSectionGUI(BuildSetupEntry b) { b.guiShowAdvancedOptions = EditorGUILayout.Foldout(b.guiShowAdvancedOptions, "Advanced Options"); if (b.guiShowAdvancedOptions) { EditorGUI.indentLevel++; #if UNITY_2020_1_OR_NEWER b.detailedBuildReport = EditorGUILayout.Toggle("Detailed Build Report", b.detailedBuildReport); #endif #if ADDRESSABLES b.rebuildAddressables = EditorGUILayout.Toggle("Rebuild Addressables", b.rebuildAddressables); #endif #if UNITY_2018_3_OR_NEWER b.strippingLevel = (ManagedStrippingLevel)EditorGUILayout.EnumPopup("Stripping Level", b.strippingLevel); #endif b.strictMode = EditorGUILayout.Toggle(new GUIContent("Strict Mode", "Do not allow the build to succeed if any errors are reported."), b.strictMode); b.assetBundleManifestPath = EditorGUILayout.TextField("AssetBundle Manifest Path", b.assetBundleManifestPath); b.scriptingBackend = (ScriptingImplementation)EditorGUILayout.EnumPopup("Scripting Backend", b.scriptingBackend); if (b.target == BuildTarget.iOS) { b.iosSymlinkLibraries = EditorGUILayout.Toggle("XCode - Symlink Library", b.iosSymlinkLibraries); } if (b.target == BuildTarget.Android) { #if UNITY_2017_4_OR_NEWER b.androidAppBundle = EditorGUILayout.Toggle("Build Android App Bundle", b.androidAppBundle); b.androidArchitecture = (AndroidArchitecture)EditorGUILayout.EnumPopup("Android Architecture", b.androidArchitecture); #endif } if (b.target == BuildTarget.PS4) { b.ps4BuildSubtarget = (PS4BuildSubtarget)EditorGUILayout.EnumPopup("PS4 Build Subtarget", b.ps4BuildSubtarget); b.ps4HardwareTarget = (PS4HardwareTarget)EditorGUILayout.EnumPopup("PS4 Hardware Target", b.ps4HardwareTarget); } EditorGUI.indentLevel--; } }
public static BuildPlayerOptions getBuildPlayerOptionsFromBuildSetupEntry(BuildSetupEntry setupEntry, string rootDirPath, string[] defaultScenes) { var buildPlayerOptions = new BuildPlayerOptions(); buildPlayerOptions.target = setupEntry.target; if (setupEntry.useDefaultBuildScenes) { buildPlayerOptions.scenes = defaultScenes; } else { buildPlayerOptions.scenes = setupEntry.customScenes.ToArray(); } var pathName = rootDirPath + "/" + setupEntry.buildName; if (setupEntry.target == BuildTarget.StandaloneWindows || setupEntry.target == BuildTarget.StandaloneWindows64) { if (!pathName.Contains(WINDOWS_EXTENSION)) { pathName += WINDOWS_EXTENSION; } } buildPlayerOptions.locationPathName = pathName; if (!string.IsNullOrEmpty(setupEntry.assetBundleManifestPath)) { buildPlayerOptions.assetBundleManifestPath = setupEntry.assetBundleManifestPath; } BuildOptions buildOptions = BuildOptions.None; if (setupEntry.debugBuild) { buildOptions |= BuildOptions.Development; } if (setupEntry.strictMode) { buildOptions |= BuildOptions.StrictMode; } if (setupEntry.target == BuildTarget.iOS) { if (setupEntry.iosSymlinkLibraries) { //Todo: Need to find specific version when this was changed #if UNITY_2021_1_OR_NEWER buildOptions |= BuildOptions.SymlinkSources; #else buildOptions |= BuildOptions.SymlinkLibraries; #endif } } #if UNITY_2020_1_OR_NEWER if (setupEntry.detailedBuildReport) { buildOptions |= BuildOptions.DetailedBuildReport; } #endif buildPlayerOptions.options = buildOptions; return(buildPlayerOptions); }
public static BuildSetupEntry Clone(BuildSetupEntry source) { return(source.MemberwiseClone() as BuildSetupEntry); }
public void deleteBuildSetupEntry(BuildSetupEntry entry) { entriesList.Remove(entry); }