InvalidOperationException: The UNKNOWN_OBJECT_TYPE EmitDrawCommandsJob.BRGRenderMeshArrays has not been assigned or constructed

com.unity.entities.graphics package version 1.2.0 and 1.2.1 are throwing me this error in Unity 6000.0.0f1’s play mode:

InvalidOperationException: The UNKNOWN_OBJECT_TYPE EmitDrawCommandsJob.BRGRenderMeshArrays has not been assigned or constructed. All containers must be valid when scheduling a job.
Unity.Jobs.LowLevel.Unsafe.JobsUtility.ScheduleParallelForDeferArraySize (Unity.Jobs.LowLevel.Unsafe.JobsUtility+JobScheduleParameters& parameters, System.Int32 innerloopBatchCount, System.Void* listData, System.Void* listDataAtomicSafetyHandle) (at <9003796c57374fd89cb8aecf8cdea52c>:0)
Unity.Jobs.IJobParallelForDeferExtensions.ScheduleInternal[T] (T& jobData, System.Int32 innerloopBatchCount, System.Void* forEachListPtr, System.Void* atomicSafetyHandlePtr, Unity.Jobs.JobHandle dependsOn) (at ./Library/PackageCache/com.unity.collections/Unity.Collections/Jobs/IJobParallelForDefer.cs:211)
Unity.Jobs.IJobParallelForDeferExtensions.Schedule[T] (T jobData, System.Int32* forEachCount, System.Int32 innerloopBatchCount, Unity.Jobs.JobHandle dependsOn) (at ./Library/PackageCache/com.unity.collections/Unity.Collections/Jobs/IJobParallelForDefer.cs:177)
Unity.Rendering.IndirectListExtensions.ScheduleWithIndirectList[T,U] (T jobData, Unity.Rendering.IndirectList`1[T] list, System.Int32 innerLoopBatchCount, Unity.Jobs.JobHandle dependencies) (at ./Library/PackageCache/com.unity.entities.graphics/Unity.Entities.Graphics/DrawCommandGeneration.cs:784)
Unity.Rendering.EntitiesGraphicsSystem.OnPerformCulling (UnityEngine.Rendering.BatchRendererGroup rendererGroup, UnityEngine.Rendering.BatchCullingContext cullingContext, UnityEngine.Rendering.BatchCullingOutput cullingOutput, System.IntPtr userContext) (at ./Library/PackageCache/com.unity.entities.graphics/Unity.Entities.Graphics/EntitiesGraphicsSystem.cs:1696)
UnityEngine.Rendering.BatchRendererGroup.InvokeOnPerformCulling (UnityEngine.Rendering.BatchRendererGroup group, UnityEngine.Rendering.BatchRendererCullingOutput& context, UnityEngine.Rendering.LODParameters& lodParameters, System.IntPtr userContext) (at <9003796c57374fd89cb8aecf8cdea52c>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Given the relative opaqueness of the error message this looks like a bug too me.

1 Like

I debugged the package’s code and the solution I found was to replace this line:

EntitiesGraphicsSystem.cs

var emitDrawCommandsDependency = emitDrawCommandsJob.ScheduleWithIndirectList(visibilityItems, 1, m_CullingJobDependency);

with:

var emitDrawCommandsDependency =
        brgRenderMeshArrays.IsCreated
    ?   emitDrawCommandsJob.ScheduleWithIndirectList( visibilityItems , 1 , m_CullingJobDependency )
    :   m_CullingJobDependency;

I found this bug in Unity 6000.0.23f1, and this solution has worked. Thank you!