ArgumentException: Assertion failure. Value was False

Error in EntityCommandBuffer on DestroyEntity playback chain:

ArgumentException: Assertion failure. Value was False
Expected: True
EntityCommandBuffer was recorded in IndicatorsSystem and played back in IndicatorsBarrier.
  at UnityEngine.Assertions.Assert.Fail (System.String message, System.String userMessage) [0x0001f] in C:\buildslave\unity\build\Runtime\Export\Assertions\Assert\AssertBase.cs:26
  at UnityEngine.Assertions.Assert.IsTrue (System.Boolean condition, System.String message) [0x0000e] in C:\buildslave\unity\build\Runtime\Export\Assertions\Assert\AssertBool.cs:20
  at UnityEngine.Assertions.Assert.IsTrue (System.Boolean condition) [0x00009] in C:\buildslave\unity\build\Runtime\Export\Assertions\Assert\AssertBool.cs:13
  at Unity.Assertions.Assert.IsTrue (System.Boolean condition) [0x00008] in E:\GAMEDEV\REPOSITORY\Elinor\Library\PackageCache\com.unity.entities@0.0.12-preview.23\Unity.Entities\Stubs\Unity.Assertions\Assert.cs:15
  at Unity.Entities.EntityCommandBuffer.SelectEntity (Unity.Entities.Entity cmdEntity, Unity.Entities.ECBSharedPlaybackState playbackState) [0x00001] in E:\GAMEDEV\REPOSITORY\Elinor\Library\PackageCache\com.unity.entities@0.0.12-preview.23\Unity.Entities\EntityCommandBuffer.cs:931
  at Unity.Entities.EntityCommandBuffer.PlaybackChain (Unity.Entities.EntityManager mgr, Unity.Entities.ECBSharedPlaybackState& playbackState, Unity.Collections.NativeArray`1[T] chainStates, System.Int32 currentChain, System.Int32 nextChain) [0x0010d] in E:\GAMEDEV\REPOSITORY\Elinor\Library\PackageCache\com.unity.entities@0.0.12-preview.23\Unity.Entities\EntityCommandBuffer.cs:1014
  at Unity.Entities.EntityCommandBuffer.Playback (Unity.Entities.EntityManager mgr) [0x0025d] in E:\GAMEDEV\REPOSITORY\Elinor\Library\PackageCache\com.unity.entities@0.0.12-preview.23\Unity.Entities\EntityCommandBuffer.cs:907
  at Unity.Entities.BarrierSystem.FlushBuffers (System.Boolean playBack) [0x00045] in E:\GAMEDEV\REPOSITORY\Elinor\Library\PackageCache\com.unity.entities@0.0.12-preview.23\Unity.Entities\ComponentSystem.cs:780
Unity.Entities.BarrierSystem.FlushBuffers (System.Boolean playBack) (at Library/PackageCache/com.unity.entities@0.0.12-preview.23/Unity.Entities/ComponentSystem.cs:801)
Unity.Entities.BarrierSystem.OnUpdate () (at Library/PackageCache/com.unity.entities@0.0.12-preview.23/Unity.Entities/ComponentSystem.cs:754)
Unity.Entities.ComponentSystem.InternalUpdate () (at Library/PackageCache/com.unity.entities@0.0.12-preview.23/Unity.Entities/ComponentSystem.cs:464)
Unity.Entities.ScriptBehaviourManager.Update () (at Library/PackageCache/com.unity.entities@0.0.12-preview.23/Unity.Entities/ScriptBehaviourManager.cs:83)
Unity.Entities.ScriptBehaviourUpdateOrder+DummyDelagateWrapper.TriggerUpdate () (at Library/PackageCache/com.unity.entities@0.0.12-preview.23/Unity.Entities/ScriptBehaviourUpdateOrder.cs:706)

Happens sometimes and only if I record more than 2-3k commands. What the reason?

Its an internal assert. Is there a way to reproduce the issue?

I’ll try reproduce it in pure project

@Joachim_Ante_1 sorry for alarm, I found HUGE mistace in just one row of my code, I’m missed one thing and my job not sets Entity field correctly in one of component, which used in ECB in other job and because this entity setted incorrectly, ECB catch this error :slight_smile:

Since I got same message recently, I try track it down, where it come from.
I see multiple threads with Assertion failure error log.

What do you mean in your case, by

When entity might be set incorrectly?

Oh it was so many days ago :slight_smile: This error little bit confusing, but main problem was - I used wrong entity :slight_smile:

1 Like

Yeah, it was quite long time ago. No worry :slight_smile: And yes, error is a bit weird and annoying. Hopefully will be more informative in future.

I will drop following message for anyone, if ever face similar issue, even from project to project case may be different.
Luckily I managed deal with it. I read some threads, which I thought could be relevant. Nothing obvious at first glance, but tried any suggestions. Yet I found out that simple fix for me was, setting CommandBuffer to concurrent in parallel jobs, which I forgot about, when I changed Job types.