void OnGUI() { //bool build = false; using (new EditorGUILayout.HorizontalScope(EditorStyles.toolbar)) { if (ToolbarButton("New", "Create a new test scene.")) { SceneHelper.CreateNewTestScene(); return; } if (ToolbarButton("Refresh", "Refresh the list of tests, in case tests that were added/removed are not reflected in the list.")) { PopulateTestEntries(); } GUILayout.FlexibleSpace(); bool override_toggle = ToolbarToggle(BuildOverride.override_build, "Update Scene List", "True to override the scenes in the Build Setting's scene list with the settings below."); if (override_toggle != BuildOverride.override_build) { XRBuildSettings.UpdateBuildSettings(); //BuildOverride.SetOverride(override_toggle); } } DrawTestList(); }
void UpdateBuildSettings() { if (GUILayout.Button("Update Build Settings")) { XRBuildSettings.UpdateBuildSettings(); } }
void CopyProjectSettings(string outputProjectPath, string rootPath) { // This method changes build settings so our EditorBuildSettings asset just has the one scene, // so we need to make sure that no matter what we update our build settings back to the way // they should be for the suite. try { EditorBuildSettings.scenes = new[] { new EditorBuildSettingsScene(m_ExportTestScenePath, true), }; AssetDatabase.SaveAssets(); var outputProjectSettings = Path.Combine(outputProjectPath, "ProjectSettings"); Directory.CreateDirectory(outputProjectSettings); foreach (var file in Directory.GetFiles(Path.Combine(rootPath, "ProjectSettings"))) { var destFile = Path.Combine(outputProjectSettings, Path.GetFileName(file)); File.Copy(file, destFile); } } finally { XRBuildSettings.UpdateBuildSettings(); } }
public static void RenderingPathSelector() { var currentPathIndex = XRBuildSettings.CurrentRenderPathIndex(); EditorGUI.BeginChangeCheck(); var guiContent = new GUIContent("Rendering Path", "The rendering path to use the project. Applied to all graphics tiers."); var newRenderingPathIndex = EditorGUILayout.Popup(guiContent, currentPathIndex, ValidRenderingPathsGuiContents()); if (EditorGUI.EndChangeCheck()) { var newRenderingPath = XRBuildSettings.ValidRenderingPaths()[newRenderingPathIndex]; foreach (BuildTargetGroup group in Enum.GetValues(typeof(BuildTargetGroup))) { foreach (GraphicsTier tier in Enum.GetValues(typeof(GraphicsTier))) { var settings = EditorGraphicsSettings.GetTierSettings(group, tier); settings.renderingPath = newRenderingPath; EditorGraphicsSettings.SetTierSettings(group, tier, settings); } } } }
static GUIContent[] ValidRenderingPathsGuiContents() { return(XRBuildSettings.ValidRenderingPaths().Select(p => new GUIContent(p.ToString())).ToArray()); }