{"record":{"id":"ce3f72f865f7017c","repo":"Unity-Technologies/UnityCsReference","slug":"columns-are-not-allowed-to-be-null","errorCode":null,"errorMessage":"Columns are not allowed to be null","messagePattern":"Columns are not allowed to be null","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/SceneModeWindows/LightingExplorerTab.cs","lineNumber":28,"sourceCode":"namespace UnityEditor\n{\n    public class LightingExplorerTab\n    {\n        SerializedPropertyTable m_LightTable;\n        GUIContent m_Title;\n\n        internal GUIContent title { get { return m_Title; } }\n\n        public LightingExplorerTab(string title, Func<UnityEngine.Object[]> objects, Func<LightingExplorerTableColumn[]> columns)\n            : this(title, objects, columns, true) {}\n\n        public LightingExplorerTab(string title, Func<UnityEngine.Object[]> objects, Func<LightingExplorerTableColumn[]> columns, bool showFilterGUI)\n        {\n            if (objects() == null)\n                throw new ArgumentException(\"Objects are not allowed to be null\", \"objects\");\n\n            if (columns() == null)\n                throw new ArgumentException(\"Columns are not allowed to be null\", \"columns\");\n\n            string serializationUID = title.Replace(\" \", string.Empty);\n\n            // Include render pipeline name in serialization ID, since different render pipelines may have different settings.\n            string rpName = GraphicsSettings.currentRenderPipeline?.pipelineTypeFullName;\n            if (string.IsNullOrEmpty(rpName))\n                rpName = \"BuiltinRP\";\n            serializationUID += $\"_{rpName.Replace(\" \", string.Empty)}\";\n\n            m_LightTable = new SerializedPropertyTable(serializationUID, new SerializedPropertyDataStore.GatherDelegate(objects), () => {\n                return Array.ConvertAll(columns(), item => item.internalColumn);\n            }, showFilterGUI);\n            m_Title = EditorGUIUtility.TrTextContent(title);\n        }\n\n        internal void OnDisable()\n        {\n            if (m_LightTable != null)","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/SceneModeWindows/LightingExplorerTab.cs#L10-L46","documentation":"Thrown by the LightingExplorerTab constructor when the columns Func returns null. The tab requires at least one LightingExplorerTableColumn to render its table; null columns means the table view cannot be constructed. The objects Func is checked first (separate guard), then columns.","triggerScenarios":"Implementing ILightingExplorerExtension.GetContentTabs and returning a tab whose columns lambda evaluates to null. A lambda that conditionally returns columns based on render pipeline state but returns null for an unsupported pipeline.","commonSituations":"Custom Lighting Explorer extension where the columns provider fails to return columns for a particular SRP. Extension authored for HDRP/URP that returns null when the builtin pipeline is active, or vice versa.","solutions":["Ensure the columns Func always returns a non-null array of LightingExplorerTableColumn.","Provide a default/fallback column set in the lambda when the expected columns are unavailable.","Return an empty array instead of null if you genuinely have no columns (though at least one is expected for a usable tab)."],"exampleFix":"// before\nnew LightingExplorerTab(\"Lights\", objectsFunc, () => hdrpColumns)\n\n// after\nnew LightingExplorerTab(\"Lights\", objectsFunc, () => hdrpColumns ?? Array.Empty<LightingExplorerTableColumn>())","handlingStrategy":"validation","validationCode":"LightingExplorerTableColumn[] SafeColumns(Func<LightingExplorerTableColumn[]> columns)\n{\n    var result = columns?.Invoke();\n    return result ?? Array.Empty<LightingExplorerTableColumn>();\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure column-provider lambdas never return null for any render pipeline.","Provide fallback columns for unsupported SRPs."],"tags":["unity","lighting","editor","validation"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}