public override void OnInspectorGUI() { serializedObject.Update(); GUILayout.Label(Styles.renderPipeSettings, EditorStyles.boldLabel); RenderPipelineAssetSelector.Draw(serializedObject, m_ScriptableRenderLoop); EditorGUILayout.Space(); bool usingSRP = GraphicsSettings.currentRenderPipeline != null; if (usingSRP) { EditorGUILayout.HelpBox("A Scriptable Render Pipeline is in use, some settings will not be used and are hidden", MessageType.Info); } if (!usingSRP) { GUILayout.Label(Styles.cameraSettings, EditorStyles.boldLabel); EditorGUILayout.PropertyField(m_TransparencySortMode); EditorGUILayout.PropertyField(m_TransparencySortAxis); EditorGUILayout.Space(); } float labelWidth = EditorGUIUtility.labelWidth; // Hide tier settings for SRPs and close tier settings window if open if (usingSRP) { TierSettingsWindow window = TierSettingsWindow.GetInstance(); if (window != null) { window.Close(); } } else { TierSettingsGUI(); } EditorGUIUtility.labelWidth = labelWidth; GUILayout.Label(Styles.builtinSettings, EditorStyles.boldLabel); if (!usingSRP) { builtinShadersEditor.OnInspectorGUI(); } videoShadersEditor.OnInspectorGUI(); alwaysIncludedShadersEditor.OnInspectorGUI(); EditorGUILayout.Space(); GUILayout.Label(Styles.shaderStrippingSettings, EditorStyles.boldLabel); shaderStrippingEditor.OnInspectorGUI(); EditorGUILayout.Space(); GUILayout.Label(Styles.shaderPreloadSettings, EditorStyles.boldLabel); EditorGUILayout.PropertyField(m_LogWhenShaderIsCompiled, Styles.logWhenShaderIsCompiled); shaderPreloadEditor.OnInspectorGUI(); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { if (EditorApplication.isPlayingOrWillChangePlaymode) { EditorGUILayout.HelpBox("Changes made in play mode will not be saved.", MessageType.Warning, true); } m_QualitySettings.Update(); var settings = GetQualitySettings(); var defaults = GetDefaultQualityForPlatforms(); var selectedLevel = QualitySettings.GetQualityLevel(); if (selectedLevel >= m_QualitySettingsProperty.arraySize) { selectedLevel = m_QualitySettingsProperty.arraySize - 1; } EditorGUI.BeginChangeCheck(); selectedLevel = DoQualityLevelSelection(selectedLevel, settings, defaults); if (EditorGUI.EndChangeCheck()) { QualitySettings.SetQualityLevel(selectedLevel); } SetQualitySettings(settings); HandleAddRemoveQualitySetting(ref selectedLevel, defaults); SetDefaultQualityForPlatforms(defaults); GUILayout.Space(10.0f); DrawHorizontalDivider(); GUILayout.Space(10.0f); var currentSettings = m_QualitySettingsProperty.GetArrayElementAtIndex(selectedLevel); var nameProperty = currentSettings.FindPropertyRelative("name"); var pixelLightCountProperty = currentSettings.FindPropertyRelative("pixelLightCount"); var shadowsProperty = currentSettings.FindPropertyRelative("shadows"); var shadowResolutionProperty = currentSettings.FindPropertyRelative("shadowResolution"); var shadowProjectionProperty = currentSettings.FindPropertyRelative("shadowProjection"); var shadowCascadesProperty = currentSettings.FindPropertyRelative("shadowCascades"); var shadowDistanceProperty = currentSettings.FindPropertyRelative("shadowDistance"); var shadowNearPlaneOffsetProperty = currentSettings.FindPropertyRelative("shadowNearPlaneOffset"); var shadowCascade2SplitProperty = currentSettings.FindPropertyRelative("shadowCascade2Split"); var shadowCascade4SplitProperty = currentSettings.FindPropertyRelative("shadowCascade4Split"); var shadowMaskUsageProperty = currentSettings.FindPropertyRelative("shadowmaskMode"); var skinWeightsProperty = currentSettings.FindPropertyRelative("skinWeights"); var textureQualityProperty = currentSettings.FindPropertyRelative("textureQuality"); var anisotropicTexturesProperty = currentSettings.FindPropertyRelative("anisotropicTextures"); var antiAliasingProperty = currentSettings.FindPropertyRelative("antiAliasing"); var softParticlesProperty = currentSettings.FindPropertyRelative("softParticles"); var realtimeReflectionProbes = currentSettings.FindPropertyRelative("realtimeReflectionProbes"); var billboardsFaceCameraPosition = currentSettings.FindPropertyRelative("billboardsFaceCameraPosition"); var vSyncCountProperty = currentSettings.FindPropertyRelative("vSyncCount"); var lodBiasProperty = currentSettings.FindPropertyRelative("lodBias"); var maximumLODLevelProperty = currentSettings.FindPropertyRelative("maximumLODLevel"); var particleRaycastBudgetProperty = currentSettings.FindPropertyRelative("particleRaycastBudget"); var asyncUploadTimeSliceProperty = currentSettings.FindPropertyRelative("asyncUploadTimeSlice"); var asyncUploadBufferSizeProperty = currentSettings.FindPropertyRelative("asyncUploadBufferSize"); var asyncUploadPersistentBufferProperty = currentSettings.FindPropertyRelative("asyncUploadPersistentBuffer"); var resolutionScalingFixedDPIFactorProperty = currentSettings.FindPropertyRelative("resolutionScalingFixedDPIFactor"); var customRenderPipeline = currentSettings.FindPropertyRelative("customRenderPipeline"); bool usingSRP = GraphicsSettings.currentRenderPipeline != null; if (string.IsNullOrEmpty(nameProperty.stringValue)) { nameProperty.stringValue = "Level " + selectedLevel; } GUILayout.Label(EditorGUIUtility.TempContent("Current Active Quality Level"), EditorStyles.boldLabel); EditorGUILayout.PropertyField(nameProperty); if (usingSRP) { EditorGUILayout.HelpBox("A Scriptable Render Pipeline is in use, some settings will not be used and are hidden", MessageType.Info); } GUILayout.Space(10); GUILayout.Label(EditorGUIUtility.TempContent("Rendering"), EditorStyles.boldLabel); RenderPipelineAssetSelector.Draw(Content.kRenderPipelineObject, m_QualitySettings, customRenderPipeline); if (!usingSRP) { EditorGUILayout.PropertyField(pixelLightCountProperty); } // still valid with SRP if (!usingSRP) { EditorGUILayout.PropertyField(antiAliasingProperty); } if (!SupportedRenderingFeatures.active.overridesRealtimeReflectionProbes) { EditorGUILayout.PropertyField(realtimeReflectionProbes); } EditorGUILayout.PropertyField(resolutionScalingFixedDPIFactorProperty); EditorGUILayout.PropertyField(vSyncCountProperty, Content.kVSyncCountLabel); if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android || EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS || EditorUserBuildSettings.activeBuildTarget == BuildTarget.tvOS) { if (vSyncCountProperty.intValue > 0) { EditorGUILayout.HelpBox(EditorGUIUtility.TrTextContent($"VSync Count '{vSyncCountProperty.enumLocalizedDisplayNames[vSyncCountProperty.enumValueIndex]}' is ignored on Android, iOS and tvOS.", EditorGUIUtility.GetHelpIcon(MessageType.Warning))); } } bool shadowMaskSupported = SupportedRenderingFeatures.IsMixedLightingModeSupported(MixedLightingMode.Shadowmask); bool showShadowMaskUsage = shadowMaskSupported && !SupportedRenderingFeatures.active.overridesShadowmask; GUILayout.Space(10); GUILayout.Label(EditorGUIUtility.TempContent("Textures"), EditorStyles.boldLabel); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(textureQualityProperty); if (EditorGUI.EndChangeCheck() && usingSRP) { RenderPipelineManager.CleanupRenderPipeline(); } if (QualitySettings.IsTextureResReducedOnAnyPlatform()) { MipStrippingHintGUI(); } EditorGUILayout.PropertyField(anisotropicTexturesProperty); var streamingMipmapsActiveProperty = currentSettings.FindPropertyRelative("streamingMipmapsActive"); EditorGUILayout.PropertyField(streamingMipmapsActiveProperty, Content.kStreamingMipmapsActive); if (streamingMipmapsActiveProperty.boolValue) { EditorGUI.indentLevel++; var streamingMipmapsAddAllCameras = currentSettings.FindPropertyRelative("streamingMipmapsAddAllCameras"); EditorGUILayout.PropertyField(streamingMipmapsAddAllCameras, Content.kStreamingMipmapsAddAllCameras); var streamingMipmapsBudgetProperty = currentSettings.FindPropertyRelative("streamingMipmapsMemoryBudget"); EditorGUILayout.PropertyField(streamingMipmapsBudgetProperty, Content.kStreamingMipmapsMemoryBudget); var streamingMipmapsRenderersPerFrameProperty = currentSettings.FindPropertyRelative("streamingMipmapsRenderersPerFrame"); EditorGUILayout.PropertyField(streamingMipmapsRenderersPerFrameProperty, Content.kStreamingMipmapsRenderersPerFrame); var streamingMipmapsMaxLevelReductionProperty = currentSettings.FindPropertyRelative("streamingMipmapsMaxLevelReduction"); EditorGUILayout.PropertyField(streamingMipmapsMaxLevelReductionProperty, Content.kStreamingMipmapsMaxLevelReduction); var streamingMipmapsMaxFileIORequestsProperty = currentSettings.FindPropertyRelative("streamingMipmapsMaxFileIORequests"); EditorGUILayout.PropertyField(streamingMipmapsMaxFileIORequestsProperty, Content.kStreamingMipmapsMaxFileIORequests); EditorGUI.indentLevel--; } GUILayout.Space(10); GUILayout.Label(EditorGUIUtility.TempContent("Particles"), EditorStyles.boldLabel); if (!usingSRP) { EditorGUILayout.PropertyField(softParticlesProperty); if (softParticlesProperty.boolValue) { SoftParticlesHintGUI(); } } EditorGUILayout.PropertyField(particleRaycastBudgetProperty); GUILayout.Space(10); GUILayout.Label(EditorGUIUtility.TempContent("Terrain"), EditorStyles.boldLabel); EditorGUILayout.PropertyField(billboardsFaceCameraPosition, Content.kBillboardsFaceCameraPos); if (!usingSRP || showShadowMaskUsage) { GUILayout.Space(10); GUILayout.Label(EditorGUIUtility.TempContent("Shadows"), EditorStyles.boldLabel); if (showShadowMaskUsage) { EditorGUILayout.PropertyField(shadowMaskUsageProperty); } if (!usingSRP) { EditorGUILayout.PropertyField(shadowsProperty); EditorGUILayout.PropertyField(shadowResolutionProperty); EditorGUILayout.PropertyField(shadowProjectionProperty); EditorGUILayout.PropertyField(shadowDistanceProperty); EditorGUILayout.PropertyField(shadowNearPlaneOffsetProperty); EditorGUILayout.PropertyField(shadowCascadesProperty); if (shadowCascadesProperty.intValue == 2) { DrawCascadeSplitGUI <float>(ref shadowCascade2SplitProperty); } else if (shadowCascadesProperty.intValue == 4) { DrawCascadeSplitGUI <Vector3>(ref shadowCascade4SplitProperty); } } } GUILayout.Space(10); GUILayout.Label(EditorGUIUtility.TempContent("Async Asset Upload"), EditorStyles.boldLabel); EditorGUILayout.PropertyField(asyncUploadTimeSliceProperty, Content.kAsyncUploadTimeSlice); EditorGUILayout.PropertyField(asyncUploadBufferSizeProperty, Content.kAsyncUploadBufferSize); EditorGUILayout.PropertyField(asyncUploadPersistentBufferProperty, Content.kAsyncUploadPersistentBuffer); asyncUploadTimeSliceProperty.intValue = Mathf.Clamp(asyncUploadTimeSliceProperty.intValue, kMinAsyncUploadTimeSlice, kMaxAsyncUploadTimeSlice); asyncUploadBufferSizeProperty.intValue = Mathf.Clamp(asyncUploadBufferSizeProperty.intValue, kMinAsyncRingBufferSize, kMaxAsyncRingBufferSize); GUILayout.Space(10); GUILayout.Label(EditorGUIUtility.TempContent("Level of Detail"), EditorStyles.boldLabel); if (!SupportedRenderingFeatures.active.overridesLODBias) { EditorGUILayout.PropertyField(lodBiasProperty, Content.kLODBiasLabel); } if (!SupportedRenderingFeatures.active.overridesMaximumLODLevel) { EditorGUILayout.PropertyField(maximumLODLevelProperty, Content.kMaximumLODLevelLabel); } GUILayout.Space(10); GUILayout.Label(EditorGUIUtility.TempContent("Meshes"), EditorStyles.boldLabel); EditorGUILayout.PropertyField(skinWeightsProperty); if (m_Dragging != null && m_Dragging.m_Position != m_Dragging.m_StartPosition) { m_QualitySettingsProperty.MoveArrayElement(m_Dragging.m_StartPosition, m_Dragging.m_Position); m_Dragging.m_StartPosition = m_Dragging.m_Position; selectedLevel = m_Dragging.m_Position; m_QualitySettings.ApplyModifiedProperties(); QualitySettings.SetQualityLevel(Mathf.Clamp(selectedLevel, 0, m_QualitySettingsProperty.arraySize - 1)); } m_QualitySettings.ApplyModifiedProperties(); }