[Solved] 2020.1.0b3 - Build - Runtime errors in HybridRenderer

I get these errors every frame in a build. It’s working fine in editor:

AssertionException: Assertion failure. Value was False
Expected: True
  at UnityEngine.Assertions.Assert.Fail (System.String message, System.String userMessage) [0x00043] in <cf2e2e90a80f4d1a92021a850f1df75a>:0
  at UnityEngine.Assertions.Assert.IsTrue (System.Boolean condition, System.String message) [0x0000f] in <cf2e2e90a80f4d1a92021a850f1df75a>:0
  at UnityEngine.Assertions.Assert.IsTrue (System.Boolean condition) [0x00009] in <cf2e2e90a80f4d1a92021a850f1df75a>:0
  at Unity.Assertions.Assert.IsTrue (System.Boolean condition) [0x00008] in H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\Stubs\Unity.Assertions\Assert.cs:15
  at Unity.Entities.ManagedComponentStore.RemoveReference (System.Int32 index, System.Int32 numRefs) [0x00032] in H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ManagedComponentStore.cs:333
  at Unity.Entities.ManagedComponentStore.Playback (Unity.Entities.ManagedDeferredCommands& managedDeferredCommands) [0x0009a] in H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ManagedComponentStore.cs:634
  at Unity.Entities.EntityCommandBuffer.ProcessTrackedChanges (EntityDataAccess* mgr, Unity.Collections.LowLevel.Unsafe.UnsafeList* managedReferenceIndexRemovalCount, Unity.Entities.EntityComponentStore+ArchetypeChanges& archetypeChanges) [0x00019] in H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\EntityCommandBuffer.cs:1904
  at Unity.Entities.EntityCommandBuffer.PlaybackInternal (EntityDataAccess mgr) [0x00485] in H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\EntityCommandBuffer.cs:1363
  at Unity.Entities.EntityCommandBuffer.Playback (Unity.Entities.EntityManager mgr) [0x00014] in H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\EntityCommandBuffer.cs:1189
  at Unity.Entities.ComponentSystem.AfterOnUpdate () [0x0000e] in H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ComponentSystem.cs:79
  at Unity.Entities.ComponentSystem.Update () [0x00054] in H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ComponentSystem.cs:115
  at Unity.Entities.ComponentSystemGroup.UpdateAllSystems () [0x0002b] in H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ComponentSystemGroup.cs:134
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
Unity.Debug:LogException(Exception) (at H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\Stubs\Unity\Debug.cs:19)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ComponentSystemGroup.cs:138)
Unity.Entities.ComponentSystemGroup:OnUpdate() (at H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ComponentSystemGroup.cs:114)
Unity.Entities.ComponentSystem:Update() (at H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ComponentSystem.cs:108)
Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ScriptBehaviourUpdateOrder.cs:152)
(Filename: <cf2e2e90a80f4d1a92021a850f1df75a> Line: 0)

Anyone else has this or knows how to debug?
Packages Manifest:

{
  "dependencies": {
    "com.unity.2d.sprite": "1.0.0",
    "com.unity.burst": "1.3.0-preview.8",
    "com.unity.entities": "0.8.0-preview.8",
    "com.unity.ide.visualstudio": "2.0.0",
    "com.unity.platforms": "0.2.1-preview.8",
    "com.unity.platforms.windows": "0.2.1-preview.8",
    "com.unity.render-pipelines.universal": "8.0.1",
    "com.unity.rendering.hybrid": "0.3.3-preview.11",
    "com.unity.scriptablebuildpipeline": "1.6.5-preview",
    "com.unity.test-framework.performance": "2.0.9-preview",
    "com.unity.textmeshpro": "3.0.0-preview.1",
    "com.unity.timeline": "1.3.1",
    "com.unity.ugui": "1.0.0",
    "com.unity.visualeffectgraph": "8.0.1",
    "com.unity.xr.legacyinputhelpers": "2.0.2",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"
  }
}

Just small note - all safety checks and leak detection enabled if you profile in editor instead of build? Sometimes I’m disable them and forgot reenable :slight_smile:

Does it make a difference for the build if all the safety checks are enabled or not?
Anyway, I tried it with both and I’m not picking up any errors in the editor.

The problem is probably on my side but I’m having no indicators what to debug as the error message is kind of generic. From the place it throws errors I can only deduct that it has something to do with SharedComponents (maybe).

I told not about build but about editor and checks, as possibility of maybe you forgot enable them and editor can suppress errors.

This is what I was interested :slight_smile:

Seemed like a follow up error. I’ve reduced it now to an error in HybridRenderer:

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in <437ba245d8404784b9fbab9b439ac908>:0
  at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <437ba245d8404784b9fbab9b439ac908>:0
  at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <437ba245d8404784b9fbab9b439ac908>:0
  at Unity.Entities.ManagedComponentStore.GetSharedComponentData[T] (System.Int32 index) [0x00015] in H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ManagedComponentStore.cs:296
  at Unity.Entities.EntityManager.GetSharedComponentData[T] (System.Int32 sharedComponentIndex) [0x00001] in H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\EntityManagerAccessComponentData.cs:217
  at Unity.Rendering.InstancedRenderMeshBatchGroup.AddBatch (Unity.Rendering.FrozenRenderSceneTag tag, System.Int32 rendererSharedComponentIndex, System.Int32 batchInstanceCount, Unity.Collections.NativeArray`1[T] chunks, Unity.Collections.NativeArray`1[T] sortedChunkIndices, System.Int32 startSortedIndex, System.Int32 chunkCount, System.Boolean flippedWinding, Unity.Entities.EditorRenderData data) [0x00030] in H:\MG\Library\PackageCache\com.unity.rendering.hybrid@0.3.3-preview.11\Unity.Rendering.Hybrid\InstancedRenderMeshBatchGroup.cs:713
  at Unity.Rendering.RenderMeshSystemV2.CacheMeshBatchRendererGroup (Unity.Rendering.FrozenRenderSceneTag tag, Unity.Collections.NativeArray`1[T] chunks, System.Int32 chunkCount) [0x001ec] in H:\MG\Library\PackageCache\com.unity.rendering.hybrid@0.3.3-preview.11\Unity.Rendering.Hybrid\RenderMeshSystemV2.cs:199
  at Unity.Rendering.RenderMeshSystemV2.UpdateDynamicRenderBatches () [0x00043] in H:\MG\Library\PackageCache\com.unity.rendering.hybrid@0.3.3-preview.11\Unity.Rendering.Hybrid\RenderMeshSystemV2.cs:279
  at Unity.Rendering.RenderMeshSystemV2.OnUpdate (Unity.Jobs.JobHandle inputDeps) [0x00044] in H:\MG\Library\PackageCache\com.unity.rendering.hybrid@0.3.3-preview.11\Unity.Rendering.Hybrid\RenderMeshSystemV2.cs:297
  at Unity.Entities.JobComponentSystem.Update () [0x00069] in H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\JobComponentSystem.cs:129
  at Unity.Entities.ComponentSystemGroup.UpdateAllSystems () [0x0002b] in H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ComponentSystemGroup.cs:134
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
Unity.Debug:LogException(Exception) (at H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\Stubs\Unity\Debug.cs:19)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ComponentSystemGroup.cs:138)
Unity.Entities.ComponentSystemGroup:OnUpdate() (at H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ComponentSystemGroup.cs:114)
Unity.Entities.ComponentSystem:Update() (at H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ComponentSystem.cs:108)
Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at H:\MG\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\ScriptBehaviourUpdateOrder.cs:152)

Will try another version of HybridRenderer.

edit: Eh, same error with HybridRenderer 0.4.0 preview8 :frowning:

Bump
Noone else having these errors with Hybrid Renderer? I’m pretty stuck on this.

edit:
Good news, it had nothing to do with Hybrid Renderer and was a cascading error that just ended with hybrid renderer tripping up.
The codebase is quite old and I didn’t realized a try/catch with no output/code in catch, was calling EntityManager.GetComponentObject(animEvent.entity) which resulted in errors because instanced entities don’t have an animator in ECS world.

Easy fix, but I’m still under the impression that this should not trip up the whole system. The editor didn’t care, same should be with builds. Sucks when there’s no stability parity and you’re never quite sure.