Search Unity

ArgumentException: Assertion failure. Value was False

Discussion in 'Entity Component System' started by eizenhorn, Feb 4, 2019.

  1. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
    Error in EntityCommandBuffer on DestroyEntity playback chain:

    upload_2019-2-4_15-50-1.png

    Code (CSharp):
    1. ArgumentException: Assertion failure. Value was False
    2. Expected: True
    3. EntityCommandBuffer was recorded in IndicatorsSystem and played back in IndicatorsBarrier.
    4.   at UnityEngine.Assertions.Assert.Fail (System.String message, System.String userMessage) [0x0001f] in C:\buildslave\unity\build\Runtime\Export\Assertions\Assert\AssertBase.cs:26
    5.   at UnityEngine.Assertions.Assert.IsTrue (System.Boolean condition, System.String message) [0x0000e] in C:\buildslave\unity\build\Runtime\Export\Assertions\Assert\AssertBool.cs:20
    6.   at UnityEngine.Assertions.Assert.IsTrue (System.Boolean condition) [0x00009] in C:\buildslave\unity\build\Runtime\Export\Assertions\Assert\AssertBool.cs:13
    7.   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
    8.   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
    9.   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
    10.   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
    11.   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
    12. Unity.Entities.BarrierSystem.FlushBuffers (System.Boolean playBack) (at Library/PackageCache/com.unity.entities@0.0.12-preview.23/Unity.Entities/ComponentSystem.cs:801)
    13. Unity.Entities.BarrierSystem.OnUpdate () (at Library/PackageCache/com.unity.entities@0.0.12-preview.23/Unity.Entities/ComponentSystem.cs:754)
    14. Unity.Entities.ComponentSystem.InternalUpdate () (at Library/PackageCache/com.unity.entities@0.0.12-preview.23/Unity.Entities/ComponentSystem.cs:464)
    15. Unity.Entities.ScriptBehaviourManager.Update () (at Library/PackageCache/com.unity.entities@0.0.12-preview.23/Unity.Entities/ScriptBehaviourManager.cs:83)
    16. 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?
     
    Last edited: Feb 4, 2019
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Its an internal assert. Is there a way to reproduce the issue?
     
  3. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
    I'll try reproduce it in pure project
     
  4. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
    @Joachim_Ante 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 :)
     
  5. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    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?
     
  6. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
    Oh it was so many days ago :) This error little bit confusing, but main problem was - I used wrong entity :)
     
    Antypodish likes this.
  7. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    Yeah, it was quite long time ago. No worry :) 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.