{"record":{"id":"41cc9c96d8705e19","repo":"Unity-Technologies/UnityCsReference","slug":"irenderpipelinegraphicssettings-is-not-assignable","errorCode":null,"errorMessage":"IRenderPipelineGraphicsSettings is not assignable from renderPipelineGraphicsSettingsType","messagePattern":"IRenderPipelineGraphicsSettings is not assignable from renderPipelineGraphicsSettingsType","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Inspector/GraphicsSettingsInspectors/GraphicsSettingsInspectorUtility.cs","lineNumber":405,"sourceCode":"        {\n            OpenAndScrollTo(typeof(TGraphicsSettings), subElementFunc);\n        }\n\n        /// <summary>\n        /// Open the Graphics Settings window and scroll to the specified Render Pipeline Graphics Settings type.\n        /// </summary>\n        /// <param name=\"renderPipelineGraphicsSettingsType\">Type of the IRenderPipelineGraphicsSettings to search for.</param>\n        /// <param name=\"subElementFunc\">Provide a Func to search for sub element in the IRenderPipelineGraphicsSettings drawer.</param>\n        /// <typeparam name=\"TVisualElement\">Type of the VisualElement to searcg for.</typeparam>\n        /// <exception cref=\"ArgumentNullException\">Throw if a renderPipelineGraphicsSettingsType is null.</exception>\n        /// <exception cref=\"ArgumentException\">Throw if a renderPipelineGraphicsSettingsType type is not derived from IRenderPipelineGraphicsSettings.</exception>\n        internal static void OpenAndScrollTo<TVisualElement>(Type renderPipelineGraphicsSettingsType, Func<TVisualElement, bool> subElementFunc = null)\n            where TVisualElement : VisualElement\n        {\n            if (renderPipelineGraphicsSettingsType == null)\n                throw new ArgumentNullException(nameof(renderPipelineGraphicsSettingsType));\n            if (!typeof(IRenderPipelineGraphicsSettings).IsAssignableFrom(renderPipelineGraphicsSettingsType))\n                throw new ArgumentException($\"{nameof(IRenderPipelineGraphicsSettings)} is not assignable from {nameof(renderPipelineGraphicsSettingsType)}\");\n\n            OpenAndScrollTo(\n                root => TryFindTabByType(renderPipelineGraphicsSettingsType, root, out var tabbedView, out var tabButton, out var bindingPath)\n                    ? (true, tabbedView, tabButton, bindingPath)\n                    : (false, tabbedView, null, null),\n                () => $\"Couldn't find a tab for {renderPipelineGraphicsSettingsType.Name} type in the settings container.\",\n                SearchForVisualElementInTabsAndScroll,\n                subElementFunc);\n        }\n\n        /// <summary>\n        /// Open the Graphics Settings window and scroll to the field specified by the set of methods.\n        /// </summary>\n        /// <param name=\"searchForVisualElement\">Search for a visual element that corresponds to the propertyPath or IRenderPipelineGraphicsSettings type.</param>\n        /// <param name=\"message\">Message to log if the visual element wasn't found. It will also return tabbed view if exists and tab button if it contains a visual element.</param>\n        /// <param name=\"execute\">Execute the method to scroll to the visual element.</param>\n        /// <param name=\"subElementFunc\">Provide a Func to search for sub element in the IRenderPipelineGraphicsSettings drawer.</param>\n        /// <typeparam name=\"TVisualElement\">Type of the VisualElement to search for.</typeparam>","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Inspector/GraphicsSettingsInspectors/GraphicsSettingsInspectorUtility.cs#L387-L423","documentation":"The generic OpenAndScrollTo<T>(Type renderPipelineGraphicsSettingsType) requires the type to implement IRenderPipelineGraphicsSettings; if typeof(IRenderPipelineGraphicsSettings).IsAssignableFrom(type) is false, it throws ArgumentException because it cannot search for a tab by that type.","triggerScenarios":"Passing a Type that does not implement IRenderPipelineGraphicsSettings — e.g. a plain data class, a ScriptableObject, or a render-pipeline asset type that isn't a graphics-settings type.","commonSituations":"Confusing a render pipeline asset type with a graphics-settings type. Reflecting over types and passing any type found. Version changes where a type moved out of the graphics-settings interface.","solutions":["Pass only types that implement IRenderPipelineGraphicsSettings.","Guard with typeof(IRenderPipelineGraphicsSettings).IsAssignableFrom(type) before calling.","Resolve the correct settings type from your render pipeline's graphics settings collection."],"exampleFix":"// before\nOpenAndScrollTo<MyField>(typeof(SomeNonSettingsType)); // throws\n\n// after\nif (typeof(IRenderPipelineGraphicsSettings).IsAssignableFrom(type))\n    OpenAndScrollTo<PropertyField>(type);","handlingStrategy":"type-guard","validationCode":"if (renderPipelineGraphicsSettingsType == null)\n    throw new ArgumentNullException(nameof(renderPipelineGraphicsSettingsType));\nif (!typeof(IRenderPipelineGraphicsSettings).IsAssignableFrom(renderPipelineGraphicsSettingsType))\n    throw new ArgumentException(\"Type must implement IRenderPipelineGraphicsSettings.\");\nGraphicsSettingsInspectorUtility.OpenAndScrollTo<PropertyField>(renderPipelineGraphicsSettingsType);","typeGuard":"static bool IsGraphicsSettingsType(Type t) =>\n    t != null && typeof(IRenderPipelineGraphicsSettings).IsAssignableFrom(t);","tryCatchPattern":null,"preventionTips":["Only pass types implementing IRenderPipelineGraphicsSettings.","Resolve graphics-settings types from the active render pipeline's settings collection, not arbitrary reflected types."],"tags":["graphics-settings","type-validation","render-pipeline","argument"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}