Unity-Technologies/UnityCsReference · error · ArgumentException

Columns are not allowed to be null

Error message

Columns are not allowed to be null

What it means

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.

Source

Thrown at Editor/Mono/SceneModeWindows/LightingExplorerTab.cs:28

namespace UnityEditor
{
    public class LightingExplorerTab
    {
        SerializedPropertyTable m_LightTable;
        GUIContent m_Title;

        internal GUIContent title { get { return m_Title; } }

        public LightingExplorerTab(string title, Func<UnityEngine.Object[]> objects, Func<LightingExplorerTableColumn[]> columns)
            : this(title, objects, columns, true) {}

        public LightingExplorerTab(string title, Func<UnityEngine.Object[]> objects, Func<LightingExplorerTableColumn[]> columns, bool showFilterGUI)
        {
            if (objects() == null)
                throw new ArgumentException("Objects are not allowed to be null", "objects");

            if (columns() == null)
                throw new ArgumentException("Columns are not allowed to be null", "columns");

            string serializationUID = title.Replace(" ", string.Empty);

            // Include render pipeline name in serialization ID, since different render pipelines may have different settings.
            string rpName = GraphicsSettings.currentRenderPipeline?.pipelineTypeFullName;
            if (string.IsNullOrEmpty(rpName))
                rpName = "BuiltinRP";
            serializationUID += $"_{rpName.Replace(" ", string.Empty)}";

            m_LightTable = new SerializedPropertyTable(serializationUID, new SerializedPropertyDataStore.GatherDelegate(objects), () => {
                return Array.ConvertAll(columns(), item => item.internalColumn);
            }, showFilterGUI);
            m_Title = EditorGUIUtility.TrTextContent(title);
        }

        internal void OnDisable()
        {
            if (m_LightTable != null)

View on GitHub (pinned to 225b0fbdb5)

Solutions

  1. Ensure the columns Func always returns a non-null array of LightingExplorerTableColumn.
  2. Provide a default/fallback column set in the lambda when the expected columns are unavailable.
  3. Return an empty array instead of null if you genuinely have no columns (though at least one is expected for a usable tab).

Example fix

// before
new LightingExplorerTab("Lights", objectsFunc, () => hdrpColumns)

// after
new LightingExplorerTab("Lights", objectsFunc, () => hdrpColumns ?? Array.Empty<LightingExplorerTableColumn>())
Defensive patterns

Strategy: validation

Validate before calling

LightingExplorerTableColumn[] SafeColumns(Func<LightingExplorerTableColumn[]> columns)
{
    var result = columns?.Invoke();
    return result ?? Array.Empty<LightingExplorerTableColumn>();
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13). Data as JSON: /api/errors/ce3f72f865f7017c. Report an issue: GitHub.