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()); }