{"record":{"id":"6030c19285072cc2","repo":"Unity-Technologies/UnityCsReference","slug":"renderinglayernames-is-null-or-empty","errorCode":null,"errorMessage":"renderingLayerNames is null or empty","messagePattern":"renderingLayerNames is null or empty","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Inspector/RenderPipelineEditorUtility.cs","lineNumber":101,"sourceCode":"\n        public static bool TryRemoveLastRenderingLayerName()\n            => TagManager.Internal_TryRemoveLastRenderingLayerName();\n\n        [AutoStaticsCleanupOnCodeReload]\n        public static Action onRenderingLayerCountChanged;\n\n        /// <summary>\n        /// Migrate Rendering Layers data from Global Settings to Tags and Layers.\n        /// </summary>\n        /// <param name=\"renderingLayerNames\">A list of rendering layer names.</param>\n        /// <typeparam name=\"T\">Render Pipeline type.</typeparam>\n        /// <returns>Returns true if it was succesful.</returns>\n        /// <exception cref=\"InvalidOperationException\">Throw an exception if rendering layer names list is null or empty.</exception>\n        internal static bool TryMigrateRenderingLayersToTagManager<T>(string[] renderingLayerNames)\n            where T: RenderPipeline\n        {\n            if (renderingLayerNames == null || renderingLayerNames.Length == 0)\n                throw new InvalidOperationException(\"renderingLayerNames is null or empty\");\n\n            var renderPipelineFullName = typeof(T).FullName;\n            var trimmedNames = new string[renderingLayerNames.Length];\n            for (int i = 0; i < renderingLayerNames.Length; i++)\n            {\n                trimmedNames[i] = renderingLayerNames[i]?.Trim() ?? string.Empty;\n            }\n\n            return TagManager.TryMigrateRenderingLayers(renderPipelineFullName, trimmedNames);\n        }\n\n        internal static void ClearMigratedRenderPipelines()\n        {\n            TagManager.ClearMigratedRenderPipelines();\n        }\n\n        /// <summary>\n        /// Retrieves the maximum number of rendering layers supported by the currently active render pipeline.","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Inspector/RenderPipelineEditorUtility.cs#L83-L119","documentation":"Thrown by TryMigrateRenderingLayersToTagManager when renderingLayerNames is null or has zero length. Despite the Try* prefix, the method enforces non-empty input by throwing rather than returning false.","triggerScenarios":"Calling TryMigrateRenderingLayersToTagManager with a null or empty string[] when migrating rendering layer names from a render pipeline's global settings to the Tags and Layers manager.","commonSituations":"Migrating rendering layers for a pipeline whose global settings have no layer names configured. Custom render pipelines that forgot to populate the layer name list. Running migration on a fresh project.","solutions":["Check renderingLayerNames != null && renderingLayerNames.Length > 0 before calling.","Populate the rendering layer names list in the pipeline's global settings before migration.","If no layers exist, skip migration rather than calling with an empty list."],"exampleFix":"// before\nRenderPipelineEditorUtility.TryMigrateRenderingLayersToTagManager<MyRP>(names);\n\n// after\nif (names != null && names.Length > 0)\n    RenderPipelineEditorUtility.TryMigrateRenderingLayersToTagManager<MyRP>(names);","handlingStrategy":"validation","validationCode":"bool ok = renderingLayerNames != null && renderingLayerNames.Length > 0;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-check the array is non-null and non-empty.","Populate layer names in global settings before migration."],"tags":["unity","editor","render-pipeline","rendering-layers","validation"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}