using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering; namespace UnityEditor.Rendering { /// /// Callback method that will be called when the Global Preferences for Additional Properties is changed /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] [Obsolete("This attribute is not handled anymore. Use Advanced Properties. #from(6000.0)", false)] public sealed class SetAdditionalPropertiesVisibilityAttribute : Attribute { } /// /// This attribute tells the class which type of /// it is an editor for. It is used to associate a custom editor /// with a specific volume component, enabling the editor to handle its custom properties and settings. /// /// /// When creating a custom editor for a , this attribute must be applied /// to the editor class to ensure it targets the appropriate component. This functionality has been deprecated, /// and developers are encouraged to use the attribute instead for newer versions. /// /// The attribute specifies which type the editor class is responsible for. /// Typically, it is used in conjunction with custom editor UI drawing and handling logic for the specified volume component. /// This provides a way for developers to create custom editing tools for their volume components in the Unity Inspector. /// /// Since Unity 2022.2, this functionality has been replaced by the attribute, and as such, /// it is advised to update any existing custom editors to use the newer approach. /// /// /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] [Obsolete("VolumeComponentEditor property has been deprecated. Please use CustomEditor. #from(2022.2)")] public sealed class VolumeComponentEditorAttribute : CustomEditor { /// /// A type derived from that this editor is responsible for. /// /// /// This field holds the type of the volume component that the editor class will handle. /// The type should be a subclass of and is used to associate the editor /// with the specific component type. /// public readonly Type componentType; /// /// Creates a new instance. /// /// A type derived from that the editor is responsible for. /// /// This constructor initializes the attribute with the component type that the editor will target. /// The component type is a subclass of and provides the necessary /// context for the editor class to function properly within the Unity Editor. /// public VolumeComponentEditorAttribute(Type componentType) : base(componentType, true) { this.componentType = componentType; } } /// /// Interface that should be used with [ScriptableRenderPipelineExtension(type))] attribute to dispatch ContextualMenu calls on the different SRPs /// /// This must be a component that require AdditionalData in your SRP [Obsolete("The menu items are handled automatically for components with the AdditionalComponentData attribute. #from(2022.2)", false)] public interface IRemoveAdditionalDataContextualMenu where T : Component { /// /// Remove the given component /// /// The component to remove /// Dependencies. void RemoveComponent(T component, IEnumerable dependencies); } public static partial class RenderPipelineGlobalSettingsUI { /// A collection of GUIContent for use in the inspector [Obsolete("Use ShaderStrippingSettings instead. #from(23.2).")] public static class Styles { /// /// Global label width /// public const int labelWidth = 250; /// /// Shader Stripping /// public static readonly GUIContent shaderStrippingSettingsLabel = EditorGUIUtility.TrTextContent("Shader Stripping", "Shader Stripping settings"); /// /// Shader Variant Log Level /// public static readonly GUIContent shaderVariantLogLevelLabel = EditorGUIUtility.TrTextContent("Shader Variant Log Level", "Controls the level of logging of shader variant information outputted during the build process. Information appears in the Unity Console when the build finishes."); /// /// Export Shader Variants /// public static readonly GUIContent exportShaderVariantsLabel = EditorGUIUtility.TrTextContent("Export Shader Variants", "Controls whether to output shader variant information to a file."); /// /// Stripping Of Rendering Debugger Shader Variants is enabled /// public static readonly GUIContent stripRuntimeDebugShadersLabel = EditorGUIUtility.TrTextContent("Strip Runtime Debug Shaders", "When enabled, all debug display shader variants are removed when you build for the Unity Player. This decreases build time, but disables some features of Rendering Debugger in Player builds."); } /// /// Draws the shader stripping settinsg /// /// The serialized global settings /// The owner editor /// Pass another drawer if you want to specify additional shader stripping settings [Obsolete("Use ShaderStrippingSettings instead. #from(23.2).")] public static void DrawShaderStrippingSettings(ISerializedRenderPipelineGlobalSettings serialized, Editor owner, CoreEditorDrawer.IDrawer additionalShaderStrippingSettings = null) { CoreEditorUtils.DrawSectionHeader(Styles.shaderStrippingSettingsLabel); var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; EditorGUILayout.Space(); using (new EditorGUI.IndentLevelScope()) { EditorGUILayout.PropertyField(serialized.shaderVariantLogLevel, Styles.shaderVariantLogLevelLabel); EditorGUILayout.PropertyField(serialized.exportShaderVariants, Styles.exportShaderVariantsLabel); EditorGUILayout.PropertyField(serialized.stripDebugVariants, Styles.stripRuntimeDebugShadersLabel); additionalShaderStrippingSettings?.Draw(serialized, owner); } EditorGUILayout.Space(); EditorGUIUtility.labelWidth = oldWidth; } } /// /// Public interface for handling a serialized object of /// [Obsolete("Use ShaderStrippingSettings instead. #from(23.2).")] public interface ISerializedRenderPipelineGlobalSettings { /// /// The /// SerializedObject serializedObject { get; } /// /// The shader variant log level /// SerializedProperty shaderVariantLogLevel { get; } /// /// If the shader variants needs to be exported /// SerializedProperty exportShaderVariants { get; } /// /// If the Runtime Rendering Debugger Debug Variants should be stripped /// SerializedProperty stripDebugVariants { get => null; } } public sealed partial class DefaultVolumeProfileEditor { /// /// Constructor /// /// Editor that displays the content of this class /// VolumeProfile to display [Obsolete("Use DefaultVolumeProfileEditor(VolumeProfile, SerializedObject) instead. #from(23.3)")] public DefaultVolumeProfileEditor(Editor baseEditor, VolumeProfile profile) { m_Profile = profile; m_TargetSerializedObject = baseEditor.serializedObject; } } /// /// Builtin Drawer for Maskfield Debug Items. /// [DebugUIDrawer(typeof(DebugUI.MaskField))] [Obsolete("DebugUI.MaskField has been deprecated and is not longer supported, please use BitField instead. #from(6000.2)", false)] public sealed class DebugUIDrawerMaskField : DebugUIFieldDrawer { /// /// Does the field of the given type /// /// The rect to draw the field /// The label for the field /// The field /// The state /// The current value from the UI protected override uint DoGUI(Rect rect, GUIContent label, DebugUI.MaskField field, DebugStateUInt state) { uint value = field.GetValue(); var enumNames = new string[field.enumNames.Length]; for (int i = 0; i < enumNames.Length; i++) enumNames[i] = field.enumNames[i].text; var mask = EditorGUI.MaskField(rect, label, (int)value, enumNames); return (uint)mask; } } }