{"record":{"id":"6c423339351e7c26","repo":"Unity-Technologies/UnityCsReference","slug":"renderpipelinetype-must-be-a-valid-renderpipe","errorCode":null,"errorMessage":"${renderPipelineType} must be a valid ${RenderPipeline}","messagePattern":"(.+?) must be a valid (.+?)","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/EditorGraphicsSettings.bindings.cs","lineNumber":63,"sourceCode":"            set { SetAlbedoSwatches(value); }\n        }\n\n        extern public static BatchRendererGroupStrippingMode batchRendererGroupShaderStrippingMode { get; }\n        extern internal static bool activeProfileHasGraphicsSettings { get; set; }\n\n        [NativeName(\"RegisterRenderPipelineSettings\")] static extern bool Internal_TryRegisterRenderPipeline(string renderpipelineName, Object settings);\n        [NativeName(\"UnregisterRenderPipelineSettings\")] static extern bool Internal_TryUnregisterRenderPipeline(string renderpipelineName);\n        [NativeName(\"GetSettingsForRenderPipeline\")] static extern Object Internal_GetSettingsForRenderPipeline(string renderpipelineName);\n\n        [NativeName(\"GetSettingsEntityIdForRenderPipeline\")] internal static extern EntityId Internal_GetSettingsEntityIdForRenderPipeline(string renderpipelineName);\n\n        private static void CheckRenderPipelineType(Type renderPipelineType)\n        {\n            if (renderPipelineType == null)\n                throw new ArgumentNullException(nameof(renderPipelineType));\n\n            if (!typeof(RenderPipeline).IsAssignableFrom(renderPipelineType))\n                throw new ArgumentException($\"{renderPipelineType} must be a valid {nameof(RenderPipeline)}\");\n        }\n\n        public static void SetRenderPipelineGlobalSettingsAsset(Type renderPipelineType, RenderPipelineGlobalSettings newSettings)\n        {\n            //In Worker thread, we cannot update assets\n            if (AssetDatabase.IsAssetImportWorkerProcess())\n                return;\n\n            CheckRenderPipelineType(renderPipelineType);\n\n            bool globalSettingsAssetChanged;\n            if (newSettings != null)\n            {\n                RenderPipelineGraphicsSettingsManager.PopulateRenderPipelineGraphicsSettings(newSettings);\n                globalSettingsAssetChanged = Internal_TryRegisterRenderPipeline(renderPipelineType.FullName, newSettings);\n            }\n            else\n                globalSettingsAssetChanged = Internal_TryUnregisterRenderPipeline(renderPipelineType.FullName);","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/EditorGraphicsSettings.bindings.cs#L45-L81","documentation":"Thrown by EditorGraphicsSettings.CheckRenderPipelineType when the supplied Type is not assignable to RenderPipeline. This guard fronts every render-pipeline settings registration/lookup API (SetRenderPipelineGlobalSettingsAsset, etc.) so that callers cannot register a non-pipeline type against the SRP settings registry.","triggerScenarios":"Passing typeof(SomeNonPipelineClass), typeof(ScriptableRendererFeature), or any Type not deriving from RenderPipeline to a global-settings method. Also passing a RenderPipeline-derived abstract type when a concrete pipeline is expected.","commonSituations":"SRP package integration code that registers a settings asset against the wrong type; custom render pipeline authoring where the registration call uses the settings type instead of the pipeline type; copy-paste from samples that reference a pipeline type not present in the project.","solutions":["Pass a Type that derives from RenderPipeline (e.g. typeof(UniversalRenderPipeline)).","If registering global settings, use the pipeline type, not the RenderPipelineGlobalSettings subclass.","Verify the SRP package version exposes the expected RenderPipeline subclass before registering."],"exampleFix":"// before\nEditorGraphicsSettings.SetRenderPipelineGlobalSettingsAsset(\n    typeof(MyRenderPipelineSettings), asset); // wrong: settings type\n\n// after\nEditorGraphicsSettings.SetRenderPipelineGlobalSettingsAsset(\n    typeof(UniversalRenderPipeline), asset);","handlingStrategy":"type-guard","validationCode":"if (renderPipelineType == null || !typeof(RenderPipeline).IsAssignableFrom(renderPipelineType)) { Debug.LogError($\"{renderPipelineType} is not a RenderPipeline\"); return; }","typeGuard":"static bool IsRenderPipelineType(Type t) => t != null && typeof(RenderPipeline).IsAssignableFrom(t);","tryCatchPattern":null,"preventionTips":["Pass the pipeline Type (e.g. typeof(UniversalRenderPipeline)), never the settings Type.","Guard all SRP settings registration calls with IsAssignableFrom checks.","Document which Type each registration API expects to prevent copy-paste mistakes."],"tags":["csharp","unity-editor","render-pipeline","srp","type-guard"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}